3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-25 01:19:23 +01:00

wiphy: store driver flags directly in wiphy object

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.
This commit is contained in:
James Prestwood 2023-06-15 12:24:09 -07:00 committed by Denis Kenzior
parent 568048b0ee
commit 6065d86fa7

View File

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