Wireless Daemon for Linux
 help / color / mirror / Atom feed
* [PATCH 1/7] wiphy: store driver flags directly in wiphy object
@ 2023-06-15 19:24 James Prestwood
  2023-06-15 19:24 ` [PATCH 2/7] wiphy: allow for user-defined driver flags James Prestwood
                   ` (5 more replies)
  0 siblings, 6 replies; 12+ messages in thread
From: James Prestwood @ 2023-06-15 19:24 UTC (permalink / raw)
  To: iwd; +Cc: James Prestwood

Rather than keep a pointer to the driver_info entry copy the flags
into the wiphy object. This preps for supporting driver flags via
a configuration file, specifically allowing for entries that are a
subset of others. For example:

{ "rtl88*",          DEFAULT_IF },
{ "rtl88x2bu",       FORCE_PAE },

Before it was not possible to add entires like this since only the
last entry match would get set. Now DEFAULT_IF would get set to all
matches, and FORCE_PAE to only rtl88x2bu. This isn't especially
important for the static list since it could be modified to work
correctly, but will be needed when parsing flags from a
configuration file that may contain duplicates or subsets of the
static list.
---
 src/wiphy.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/src/wiphy.c b/src/wiphy.c
index d06b2447..ca8a4958 100644
--- a/src/wiphy.c
+++ b/src/wiphy.c
@@ -111,7 +111,7 @@ struct wiphy {
 	char *model_str;
 	char *vendor_str;
 	char *driver_str;
-	const struct driver_info *driver_info;
+	uint32_t driver_flags;
 	struct watchlist state_watches;
 	uint8_t extended_capabilities[EXT_CAP_LEN + 2]; /* max bitmap size + IE header */
 	uint8_t *iftype_extended_capabilities[NUM_NL80211_IFTYPES];
@@ -685,8 +685,7 @@ bool wiphy_uses_default_if(struct wiphy *wiphy)
 	if (!wiphy_get_driver(wiphy))
 		return true;
 
-	if (wiphy->driver_info &&
-			wiphy->driver_info->flags & DEFAULT_IF)
+	if (wiphy->driver_flags & DEFAULT_IF)
 		return true;
 
 	return false;
@@ -697,8 +696,7 @@ bool wiphy_control_port_enabled(struct wiphy *wiphy)
 	const struct l_settings *settings = iwd_get_config();
 	bool enabled;
 
-	if (wiphy->driver_info &&
-			wiphy->driver_info->flags & FORCE_PAE) {
+	if (wiphy->driver_flags & FORCE_PAE) {
 		l_info("Not using Control Port due to driver quirks: %s",
 				wiphy_get_driver(wiphy));
 		return false;
@@ -1885,7 +1883,7 @@ static bool wiphy_get_driver_name(struct wiphy *wiphy)
 
 	for (i = 0; i < L_ARRAY_SIZE(driver_infos); i++)
 		if (!fnmatch(driver_infos[i].prefix, wiphy->driver_str, 0))
-			wiphy->driver_info = &driver_infos[i];
+			wiphy->driver_flags |= driver_infos[i].flags;
 
 	return true;
 }
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2023-06-19 14:54 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-15 19:24 [PATCH 1/7] wiphy: store driver flags directly in wiphy object James Prestwood
2023-06-15 19:24 ` [PATCH 2/7] wiphy: allow for user-defined driver flags James Prestwood
2023-06-18 19:03   ` Denis Kenzior
2023-06-15 19:24 ` [PATCH 3/7] doc: document [DriverFlags] group settings James Prestwood
2023-06-15 19:24 ` [PATCH 4/7] wiphy: add [DriverFlags].PowerSaveDisable flag James Prestwood
2023-06-18 19:07   ` Denis Kenzior
2023-06-19 14:49     ` James Prestwood
2023-06-15 19:24 ` [PATCH 5/7] netdev: disable power save if required James Prestwood
2023-06-18 19:11   ` Denis Kenzior
2023-06-19 14:54     ` James Prestwood
2023-06-15 19:24 ` [PATCH 6/7] wiphy: print driver flags on startup James Prestwood
2023-06-15 19:24 ` [PATCH 7/7] doc: Document [DriverFlags].PowerSaveDisable James Prestwood

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox