Skip to contentSkip to conversation

wifi: mac80211: Deadcode cleanup

PATCH In review [email protected] 2 participants 6 messages Dec 24, 2024 – Jan 28, 2025 mac80211

lore
Share & tools
lore
#0 lore raw

cover wifi: mac80211: Deadcode cleanup

From: "Dr. David Alan Gilbert" <[email protected]>

Hi,
This pair of patches removes a bunch of functions that haven't
been called for more than a few years.

I suspect I could go further; in particular I wonder if
ieee80211_debugfs_key_remove_beacon_default()
and
ieee80211_debugfs_key_remove_mgmt_default()

could go together with a data structure somewhere?

Also, ieee80211_nan_func_match() was the last use of cfg80211_nan_match(); but that would be in a separate area.

Dave

Dr. David Alan Gilbert (2):
wifi: mac80211: Clean up debugfs_key deadcode
wifi: mac80211: Remove unused ieee80211_nan_func_match

 include/net/mac80211.h     | 15 ------------
 net/mac80211/cfg.c         | 25 --------------------
 net/mac80211/debugfs_key.c | 47 --------------------------------------
 net/mac80211/debugfs_key.h | 15 ------------
 4 files changed, 102 deletions(-)
Signature · 1 line
2.47.1
#1 lore raw

PATCH 1/2 wifi: mac80211: Clean up debugfs_key deadcode

From: "Dr. David Alan Gilbert" <[email protected]>

The last use of ieee80211_debugfs_key_sta_del() was removed in 2007 by commit 11a843b7e160 ("[MAC80211]: rework key handling")

The last use of ieee80211_debugfs_key_add_mgmt_default() was removed in 2010 by
commit f7e0104c1a4e ("mac80211: support separate default keys")

The last use of ieee80211_debugfs_key_add_beacon_default() was removed in 2020 by
commit e5473e80d467 ("mac80211: Support BIGTK configuration for Beacon protection")

Remove them.

---
 net/mac80211/debugfs_key.c | 47 --------------------------------------
 net/mac80211/debugfs_key.h | 15 ------------
 2 files changed, 62 deletions(-)
net/mac80211/debugfs_key.c +0 -47
index b3a64edea0f2..117f58af5ff9 100644
@@ -402,25 +402,6 @@ void ieee80211_debugfs_key_update_default(struct ieee80211_sub_if_data *sdata)
 	}
 }
 
-void ieee80211_debugfs_key_add_mgmt_default(struct ieee80211_sub_if_data *sdata)
-{
-	char buf[50];
-	struct ieee80211_key *key;
-
-	if (!sdata->vif.debugfs_dir)
-		return;
-
-	key = wiphy_dereference(sdata->local->hw.wiphy,
-				sdata->deflink.default_mgmt_key);
-	if (key) {
-		sprintf(buf, "../keys/%d", key->debugfs.cnt);
-		sdata->debugfs.default_mgmt_key =
-			debugfs_create_symlink("default_mgmt_key",
-					       sdata->vif.debugfs_dir, buf);
-	} else
-		ieee80211_debugfs_key_remove_mgmt_default(sdata);
-}
-
 void ieee80211_debugfs_key_remove_mgmt_default(struct ieee80211_sub_if_data *sdata)
 {
 	if (!sdata)
@@ -430,27 +411,6 @@ void ieee80211_debugfs_key_remove_mgmt_default(struct ieee80211_sub_if_data *sda
 	sdata->debugfs.default_mgmt_key = NULL;
 }
 
-void
-ieee80211_debugfs_key_add_beacon_default(struct ieee80211_sub_if_data *sdata)
-{
-	char buf[50];
-	struct ieee80211_key *key;
-
-	if (!sdata->vif.debugfs_dir)
-		return;
-
-	key = wiphy_dereference(sdata->local->hw.wiphy,
-				sdata->deflink.default_beacon_key);
-	if (key) {
-		sprintf(buf, "../keys/%d", key->debugfs.cnt);
-		sdata->debugfs.default_beacon_key =
-			debugfs_create_symlink("default_beacon_key",
-					       sdata->vif.debugfs_dir, buf);
-	} else {
-		ieee80211_debugfs_key_remove_beacon_default(sdata);
-	}
-}
-
 void
 ieee80211_debugfs_key_remove_beacon_default(struct ieee80211_sub_if_data *sdata)
 {
@@ -460,10 +420,3 @@ ieee80211_debugfs_key_remove_beacon_default(struct ieee80211_sub_if_data *sdata)
 	debugfs_remove(sdata->debugfs.default_beacon_key);
 	sdata->debugfs.default_beacon_key = NULL;
 }
-
-void ieee80211_debugfs_key_sta_del(struct ieee80211_key *key,
-				   struct sta_info *sta)
-{
-	debugfs_remove(key->debugfs.stalink);
-	key->debugfs.stalink = NULL;
-}
net/mac80211/debugfs_key.h +0 -15
index af7cf495f8d1..e17a48d5c6cc 100644
@@ -6,16 +6,10 @@
 void ieee80211_debugfs_key_add(struct ieee80211_key *key);
 void ieee80211_debugfs_key_remove(struct ieee80211_key *key);
 void ieee80211_debugfs_key_update_default(struct ieee80211_sub_if_data *sdata);
-void ieee80211_debugfs_key_add_mgmt_default(
-	struct ieee80211_sub_if_data *sdata);
 void ieee80211_debugfs_key_remove_mgmt_default(
 	struct ieee80211_sub_if_data *sdata);
-void ieee80211_debugfs_key_add_beacon_default(
-	struct ieee80211_sub_if_data *sdata);
 void ieee80211_debugfs_key_remove_beacon_default(
 	struct ieee80211_sub_if_data *sdata);
-void ieee80211_debugfs_key_sta_del(struct ieee80211_key *key,
-				   struct sta_info *sta);
 #else
 static inline void ieee80211_debugfs_key_add(struct ieee80211_key *key)
 {}
@@ -24,21 +18,12 @@ static inline void ieee80211_debugfs_key_remove(struct ieee80211_key *key)
 static inline void ieee80211_debugfs_key_update_default(
 	struct ieee80211_sub_if_data *sdata)
 {}
-static inline void ieee80211_debugfs_key_add_mgmt_default(
-	struct ieee80211_sub_if_data *sdata)
-{}
 static inline void ieee80211_debugfs_key_remove_mgmt_default(
 	struct ieee80211_sub_if_data *sdata)
 {}
-static inline void ieee80211_debugfs_key_add_beacon_default(
-	struct ieee80211_sub_if_data *sdata)
-{}
 static inline void ieee80211_debugfs_key_remove_beacon_default(
 	struct ieee80211_sub_if_data *sdata)
 {}
-static inline void ieee80211_debugfs_key_sta_del(struct ieee80211_key *key,
-						 struct sta_info *sta)
-{}
 #endif
 
 #endif /* __MAC80211_DEBUGFS_KEY_H */
Signature · 1 line
2.47.1
#2 lore raw

PATCH 2/2 wifi: mac80211: Remove unused ieee80211_nan_func_match

In reply to [email protected]

From: "Dr. David Alan Gilbert" <[email protected]>

ieee80211_nan_func_match() was explicitly added in 2016 by commit 92bc43bce284 ("mac80211: Add API to report NAN function match")

but has remained unused.

Remove it.

---
 include/net/mac80211.h | 15 ---------------
 net/mac80211/cfg.c     | 25 -------------------------
 2 files changed, 40 deletions(-)
include/net/mac80211.h +0 -15
index ab8dce1f2c27..47d67b1f7d02 100644
@@ -7550,21 +7550,6 @@ void ieee80211_nan_func_terminated(struct ieee80211_vif *vif,
 				   enum nl80211_nan_func_term_reason reason,
 				   gfp_t gfp);
 
-/**
- * ieee80211_nan_func_match - notify about NAN function match event.
- *
- * This function is used to notify mac80211 about NAN function match. The
- * cookie inside the match struct will be assigned by mac80211.
- * Note that this function can't be called from hard irq.
- *
- * @vif: &struct ieee80211_vif pointer from the add_interface callback.
- * @match: match event information
- * @gfp: allocation flags
- */
-void ieee80211_nan_func_match(struct ieee80211_vif *vif,
-			      struct cfg80211_nan_match_params *match,
-			      gfp_t gfp);
-
 /**
  * ieee80211_calc_rx_airtime - calculate estimated transmission airtime for RX.
  *
net/mac80211/cfg.c +0 -25
index d3fc158ccaf6..50b4ec777349 100644
@@ -4525,31 +4525,6 @@ void ieee80211_nan_func_terminated(struct ieee80211_vif *vif,
 }
 EXPORT_SYMBOL(ieee80211_nan_func_terminated);
 
-void ieee80211_nan_func_match(struct ieee80211_vif *vif,
-			      struct cfg80211_nan_match_params *match,
-			      gfp_t gfp)
-{
-	struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif);
-	struct cfg80211_nan_func *func;
-
-	if (WARN_ON(vif->type != NL80211_IFTYPE_NAN))
-		return;
-
-	spin_lock_bh(&sdata->u.nan.func_lock);
-
-	func = idr_find(&sdata->u.nan.function_inst_ids,  match->inst_id);
-	if (WARN_ON(!func)) {
-		spin_unlock_bh(&sdata->u.nan.func_lock);
-		return;
-	}
-	match->cookie = func->cookie;
-
-	spin_unlock_bh(&sdata->u.nan.func_lock);
-
-	cfg80211_nan_match(ieee80211_vif_to_wdev(vif), match, gfp);
-}
-EXPORT_SYMBOL(ieee80211_nan_func_match);
-
 static int ieee80211_set_multicast_to_unicast(struct wiphy *wiphy,
 					      struct net_device *dev,
 					      const bool enabled)
Signature · 1 line
2.47.1
#3 lore raw
In reply to [email protected]
Quoted 14 lines · * [email protected] ([email protected]) wrote:

From: "Dr. David Alan Gilbert" <[email protected]>

Hi,
This pair of patches removes a bunch of functions that haven't
been called for more than a few years.

I suspect I could go further; in particular I wonder if
ieee80211_debugfs_key_remove_beacon_default()
and
ieee80211_debugfs_key_remove_mgmt_default()

could go together with a data structure somewhere?

Quoted 8 lines

Also, ieee80211_nan_func_match() was the last use of cfg80211_nan_match(); but that would be in a separate area.

Dave

Dr. David Alan Gilbert (2):
wifi: mac80211: Clean up debugfs_key deadcode
wifi: mac80211: Remove unused ieee80211_nan_func_match

Hi,
I noticed one of these patches (debugfs_key) has landed in 6.14
but the other one I don't think has - any particular reason?

Dave

Quoted 10 lines
 include/net/mac80211.h     | 15 ------------
 net/mac80211/cfg.c         | 25 --------------------
 net/mac80211/debugfs_key.c | 47 --------------------------------------
 net/mac80211/debugfs_key.h | 15 ------------
 4 files changed, 102 deletions(-)
Signature · 1 line
2.47.1
Signature · 4 lines
 -----Open up your eyes, open up your mind, open up your code -------   
/ Dr. David Alan Gilbert    |       Running GNU/Linux       | Happy  \ 
\        dave @ treblig.org |                               | In Hex /
 \ _________________________|_____ http://www.treblig.org   |_______/
maintainer
#4 lore raw
Quoted 6 lines · Dr. David Alan Gilbert
Quoted 2 lines

wifi: mac80211: Remove unused ieee80211_nan_func_match

Hi,
I noticed one of these patches (debugfs_key) has landed in 6.14
but the other one I don't think has - any particular reason?

We were still using NAN internally, and there's a chance that it might make a comeback, so I was holding off on it for now.

johannes

#5 lore raw
Quoted 10 lines · * Johannes Berg ([email protected]) wrote:
Quoted 6 lines · Dr. David Alan Gilbert
Quoted 2 lines

wifi: mac80211: Remove unused ieee80211_nan_func_match

Hi,
I noticed one of these patches (debugfs_key) has landed in 6.14
but the other one I don't think has - any particular reason?

We were still using NAN internally, and there's a chance that it might make a comeback, so I was holding off on it for now.

Ah OK.

Thanks!

Dave

Quoted 1 line

johannes

Signature · 4 lines
 -----Open up your eyes, open up your mind, open up your code -------   
/ Dr. David Alan Gilbert    |       Running GNU/Linux       | Happy  \ 
\        dave @ treblig.org |                               | In Hex /
 \ _________________________|_____ http://www.treblig.org   |_______/