3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-12-22 21:22:37 +01:00

wiphy: Add wiphy_create_complete

Let manager.c signal to wiphy.c when the wiphy parsing from the genl
messages is complete.  When we query for existing wiphy using the
GET_WIPHY dump command we get many genl messages per wiphy, on a
notification we only get one message.  So after wiphy_create there may
be one or many calls to wiphy_update_from_genl.  wiphy_create_complete
is called after all of them, so wiphy.c can be sure it's done with
parsing the wiphy attributes when in prints the new wiphy summary log
message, like it did before manager.c was added.

I had wrongly assumed that all the important wiphy attributes were in
the first message in the dump, but NL80211_ATTR_EXT_FEATURES was not and
wasn't being parsed which was breaking at least testRSSIAgent.
This commit is contained in:
Andrew Zaborowski 2019-04-20 22:29:06 +02:00 committed by Denis Kenzior
parent 0a196025f2
commit 14d69873b0
3 changed files with 15 additions and 6 deletions

View File

@ -449,6 +449,8 @@ static void manager_new_wiphy_event(struct l_genl_msg *msg)
if (!state) if (!state)
return; return;
wiphy_create_complete(state->wiphy);
/* Setup a timer just in case a default interface is not created */ /* Setup a timer just in case a default interface is not created */
state->setup_timeout = l_timeout_create(1, manager_wiphy_setup_timeout, state->setup_timeout = l_timeout_create(1, manager_wiphy_setup_timeout,
state, NULL); state, NULL);
@ -605,7 +607,12 @@ static void manager_interface_dump_done(void *user_data)
struct wiphy_setup_state *state = entry->data; struct wiphy_setup_state *state = entry->data;
/* phy might have been detected after the initial dump */ /* phy might have been detected after the initial dump */
if (state->setup_timeout || state->pending_cmd_count) if (state->setup_timeout)
continue;
wiphy_create_complete(state->wiphy);
if (state->pending_cmd_count)
continue; continue;
/* If we are here, then there are no interfaces for this phy */ /* If we are here, then there are no interfaces for this phy */

View File

@ -751,11 +751,12 @@ void wiphy_update_from_genl(struct wiphy *wiphy, struct l_genl_msg *msg)
IWD_WIPHY_INTERFACE, "Name"); IWD_WIPHY_INTERFACE, "Name");
} }
if (!wiphy->supported_iftypes) {
/* Most likely a new wiphy, set all the parameters */
wiphy_parse_attributes(wiphy, &attr); wiphy_parse_attributes(wiphy, &attr);
wiphy_print_basic_info(wiphy);
} }
void wiphy_create_complete(struct wiphy *wiphy)
{
wiphy_print_basic_info(wiphy);
} }
bool wiphy_destroy(struct wiphy *wiphy) bool wiphy_destroy(struct wiphy *wiphy)

View File

@ -49,6 +49,7 @@ bool wiphy_parse_id_and_name(struct l_genl_attr *attr, uint32_t *out_id,
struct wiphy *wiphy_find(int wiphy_id); struct wiphy *wiphy_find(int wiphy_id);
struct wiphy *wiphy_create(uint32_t wiphy_id, const char *name); struct wiphy *wiphy_create(uint32_t wiphy_id, const char *name);
void wiphy_create_complete(struct wiphy *wiphy);
bool wiphy_destroy(struct wiphy *wiphy); bool wiphy_destroy(struct wiphy *wiphy);
void wiphy_update_from_genl(struct wiphy *wiphy, struct l_genl_msg *msg); void wiphy_update_from_genl(struct wiphy *wiphy, struct l_genl_msg *msg);