nl80211: Reduce the number of nlctrl name resolution calls
The number of nlctrl name resolution calls required to connect to a WPA2-PSK AP is 12. And each nlctrl name resolution call spends 55 micro seconds on a lower spec CPU like Intel Atom N270. Reduce the number of nctrl name resolution calls from 12 to 1 by caching the results of nctrl name resolution calls on int size memory to speed up the connection process a little bit. Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
This commit is contained in:
parent
2bbc5a2b09
commit
4c80937c7f
2 changed files with 9 additions and 1 deletions
|
@ -604,7 +604,7 @@ static int nl_get_multicast_id(struct nl80211_global *global,
|
||||||
msg = nlmsg_alloc();
|
msg = nlmsg_alloc();
|
||||||
if (!msg)
|
if (!msg)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
if (!genlmsg_put(msg, 0, 0, genl_ctrl_resolve(global->nl, "nlctrl"),
|
if (!genlmsg_put(msg, 0, 0, global->nlctrl_id,
|
||||||
0, 0, CTRL_CMD_GETFAMILY, 0) ||
|
0, 0, CTRL_CMD_GETFAMILY, 0) ||
|
||||||
nla_put_string(msg, CTRL_ATTR_FAMILY_NAME, family)) {
|
nla_put_string(msg, CTRL_ATTR_FAMILY_NAME, family)) {
|
||||||
nlmsg_free(msg);
|
nlmsg_free(msg);
|
||||||
|
@ -1883,6 +1883,13 @@ static int wpa_driver_nl80211_init_nl_global(struct nl80211_global *global)
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
global->nlctrl_id = genl_ctrl_resolve(global->nl, "nlctrl");
|
||||||
|
if (global->nlctrl_id < 0) {
|
||||||
|
wpa_printf(MSG_ERROR,
|
||||||
|
"nl80211: 'nlctrl' generic netlink not found");
|
||||||
|
goto err;
|
||||||
|
}
|
||||||
|
|
||||||
global->nl_event = nl_create_handle(global->nl_cb, "event");
|
global->nl_event = nl_create_handle(global->nl_cb, "event");
|
||||||
if (global->nl_event == NULL)
|
if (global->nl_event == NULL)
|
||||||
goto err;
|
goto err;
|
||||||
|
|
|
@ -32,6 +32,7 @@ struct nl80211_global {
|
||||||
struct nl_cb *nl_cb;
|
struct nl_cb *nl_cb;
|
||||||
struct nl_sock *nl;
|
struct nl_sock *nl;
|
||||||
int nl80211_id;
|
int nl80211_id;
|
||||||
|
int nlctrl_id;
|
||||||
int ioctl_sock; /* socket for ioctl() use */
|
int ioctl_sock; /* socket for ioctl() use */
|
||||||
|
|
||||||
struct nl_sock *nl_event;
|
struct nl_sock *nl_event;
|
||||||
|
|
Loading…
Reference in a new issue