Search Linux Wireless

[PATCH] wifi: mac80211: Debugfs handling for virtual monitor

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Create/delete debugfs entry for the virtual monitor interface according
to the state of the virtual monitor interface.

This fixes the following issues:
 1) Debugfs is not getting an entry when the virtual monitor interface
    is created.
 2) Instead debugfs gets an entry when it's deleted.
 3) And debugfs warns, that it already has directory for the virtual
    monitor interface every time the virtual monitor interface is
    removed again after the first time.

Signed-off-by: Alexander Wetzel <Alexander@xxxxxxxxxxxxxx>
---
Changes compared to the RFC patch in
https://lore.kernel.org/linux-wireless/20250127162625.20747-3-Alexander@xxxxxxxxxxxxxx/

 Moved debugfs and SDATA_STATE_RUNNING to the end of
 ieee80211_add_virtual_monitor()
---
 net/mac80211/iface.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c
index 7d3ebfcb8c2b..bee11f5da16c 100644
--- a/net/mac80211/iface.c
+++ b/net/mac80211/iface.c
@@ -1153,8 +1153,6 @@ int ieee80211_add_virtual_monitor(struct ieee80211_local *local)
 		}
 	}
 
-	set_bit(SDATA_STATE_RUNNING, &sdata->state);
-
 	ret = ieee80211_check_queues(sdata, NL80211_IFTYPE_MONITOR);
 	if (ret) {
 		kfree(sdata);
@@ -1177,6 +1175,9 @@ int ieee80211_add_virtual_monitor(struct ieee80211_local *local)
 		return ret;
 	}
 
+	ieee80211_debugfs_recreate_netdev(sdata, false);
+	set_bit(SDATA_STATE_RUNNING, &sdata->state);
+
 	skb_queue_head_init(&sdata->skb_queue);
 	skb_queue_head_init(&sdata->status_queue);
 	wiphy_work_init(&sdata->work, ieee80211_iface_work);
@@ -1203,6 +1204,7 @@ void ieee80211_del_virtual_monitor(struct ieee80211_local *local)
 		return;
 	}
 
+	clear_bit(SDATA_STATE_RUNNING, &sdata->state);
 	RCU_INIT_POINTER(local->monitor_sdata, NULL);
 	mutex_unlock(&local->iflist_mtx);
 
@@ -1213,6 +1215,7 @@ void ieee80211_del_virtual_monitor(struct ieee80211_local *local)
 	if (ieee80211_hw_check(&local->hw, WANT_MONITOR_VIF))
 		drv_remove_interface(local, sdata);
 
+	ieee80211_debugfs_remove_netdev(sdata);
 	kfree(sdata);
 }
 
-- 
2.48.1





[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Wireless Regulations]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux