mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-11-22 06:29:23 +01:00
wiphy: don't re-dump wiphy if the regdom didn't change
For whatever reason the kernel will send regdom updates even if the regdom didn't change. This ends up causing wiphy to dump which isn't needed since there should be no changes in disabled frequencies. Now the previous country is checked against the new one, and if they match the wiphy is not dumped again.
This commit is contained in:
parent
1709148484
commit
911572f09a
39
src/wiphy.c
39
src/wiphy.c
@ -2026,10 +2026,19 @@ static void wiphy_dump_after_regdom(struct wiphy *wiphy)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void wiphy_update_reg_domain(struct wiphy *wiphy, bool global,
|
static bool wiphy_update_reg_domain(struct wiphy *wiphy, bool global,
|
||||||
struct l_genl_msg *msg)
|
struct l_genl_msg *msg)
|
||||||
{
|
{
|
||||||
char *out_country;
|
char out_country[2];
|
||||||
|
char *orig;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Write the new country code or XX if the reg domain is not a
|
||||||
|
* country domain.
|
||||||
|
*/
|
||||||
|
if (nl80211_parse_attrs(msg, NL80211_ATTR_REG_ALPHA2, out_country,
|
||||||
|
NL80211_ATTR_UNSPEC) < 0)
|
||||||
|
out_country[0] = out_country[1] = 'X';
|
||||||
|
|
||||||
if (global)
|
if (global)
|
||||||
/*
|
/*
|
||||||
@ -2043,21 +2052,26 @@ static void wiphy_update_reg_domain(struct wiphy *wiphy, bool global,
|
|||||||
* wiphy created (that is not self-managed anyway) and we
|
* wiphy created (that is not self-managed anyway) and we
|
||||||
* haven't received any REG_CHANGE events yet.
|
* haven't received any REG_CHANGE events yet.
|
||||||
*/
|
*/
|
||||||
out_country = regdom_country;
|
orig = regdom_country;
|
||||||
|
|
||||||
else
|
else
|
||||||
out_country = wiphy->regdom_country;
|
orig = wiphy->regdom_country;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Write the new country code or XX if the reg domain is not a
|
* The kernel seems to send regdom updates even if the country didn't
|
||||||
* country domain.
|
* change. Skip these as there is no reason to re-dump.
|
||||||
*/
|
*/
|
||||||
if (nl80211_parse_attrs(msg, NL80211_ATTR_REG_ALPHA2, out_country,
|
if (orig[0] == out_country[0] && orig[1] == out_country[1])
|
||||||
NL80211_ATTR_UNSPEC) < 0)
|
return false;
|
||||||
out_country[0] = out_country[1] = 'X';
|
|
||||||
|
|
||||||
l_debug("New reg domain country code for %s is %c%c",
|
l_debug("New reg domain country code for %s is %c%c",
|
||||||
global ? "(global)" : wiphy->name,
|
global ? "(global)" : wiphy->name,
|
||||||
out_country[0], out_country[1]);
|
out_country[0], out_country[1]);
|
||||||
|
|
||||||
|
orig[0] = out_country[0];
|
||||||
|
orig[1] = out_country[1];
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void wiphy_get_reg_cb(struct l_genl_msg *msg, void *user_data)
|
static void wiphy_get_reg_cb(struct l_genl_msg *msg, void *user_data)
|
||||||
@ -2305,7 +2319,8 @@ static void wiphy_reg_notify(struct l_genl_msg *msg, void *user_data)
|
|||||||
|
|
||||||
switch (cmd) {
|
switch (cmd) {
|
||||||
case NL80211_CMD_REG_CHANGE:
|
case NL80211_CMD_REG_CHANGE:
|
||||||
wiphy_update_reg_domain(NULL, true, msg);
|
if (!wiphy_update_reg_domain(NULL, true, msg))
|
||||||
|
return;
|
||||||
break;
|
break;
|
||||||
case NL80211_CMD_WIPHY_REG_CHANGE:
|
case NL80211_CMD_WIPHY_REG_CHANGE:
|
||||||
if (nl80211_parse_attrs(msg, NL80211_ATTR_WIPHY, &wiphy_id,
|
if (nl80211_parse_attrs(msg, NL80211_ATTR_WIPHY, &wiphy_id,
|
||||||
@ -2316,7 +2331,9 @@ static void wiphy_reg_notify(struct l_genl_msg *msg, void *user_data)
|
|||||||
if (!wiphy)
|
if (!wiphy)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
wiphy_update_reg_domain(wiphy, false, msg);
|
if (!wiphy_update_reg_domain(wiphy, false, msg))
|
||||||
|
return;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return;
|
return;
|
||||||
|
Loading…
Reference in New Issue
Block a user