]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
wifi: mac80211: improve interface iteration ergonomics
authorJohannes Berg <johannes.berg@intel.com>
Thu, 8 Jan 2026 13:34:31 +0000 (14:34 +0100)
committerJohannes Berg <johannes.berg@intel.com>
Mon, 12 Jan 2026 18:48:17 +0000 (19:48 +0100)
commit6b3bafa2bd6b778a92884834b7382ed39b692155
treef7033c557e876d8a3ac97d69f7088f09143e919b
parente1cbdf78f60c35a1a320ca401852fd6a73624a4a
wifi: mac80211: improve interface iteration ergonomics

Right now, the only way to iterate interfaces is to declare an
iterator function, possibly data structure to use, and pass all
that to the iteration helper function. This is annoying, and
there's really no inherent need for it, except it was easier to
implement with the iflist mutex, but that's not used much now.

Add a new for_each_interface() macro that does the iteration in
a more ergonomic way. To avoid even more exported functions, do
the old ieee80211_iterate_active_interfaces_mtx() as an inline
using the new way, which may also let the compiler optimise it
a bit more, e.g. via inlining the iterator function.

Also provide for_each_active_interface() for the common case of
just iterating active interfaces.

Link: https://patch.msgid.link/20260108143431.f2581e0c381a.Ie387227504c975c109c125b3c57f0bb3fdab2835@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
include/net/mac80211.h
net/mac80211/util.c