3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-26 18:59:22 +01:00

netdev: optimize GAS request timeout

A not-yet-merged kernel patch will enable the FRAME_WAIT_CANCEL
event to be emitted when a CMD_FRAME duration expires. This can
shortcut the ridiculously long timeout that is required making
GAS requests with no response drastically quicker to handle.
This commit is contained in:
James Prestwood 2019-06-14 14:56:14 -07:00 committed by Denis Kenzior
parent 1e33eaa072
commit baf6b3ee4d

View File

@ -2874,6 +2874,43 @@ static void netdev_gas_timeout_cb(struct l_timeout *timeout, void *user_data)
destroy(anqp_data); destroy(anqp_data);
} }
static void netdev_frame_wait_cancel_event(struct l_genl_msg *msg,
struct netdev *netdev)
{
struct l_genl_attr attr;
uint16_t type, len;
const void *data;
uint64_t cookie = 0;
l_debug("");
if (!netdev->anqp_cb)
return;
if (!l_genl_attr_init(&attr, msg))
return;
while (l_genl_attr_next(&attr, &type, &len, &data)) {
switch (type) {
case NL80211_ATTR_COOKIE:
if (len != 8)
return;
cookie = l_get_u64(data);
break;
}
}
if (!cookie)
return;
if (cookie != netdev->anqp_cookie)
return;
netdev_gas_timeout_cb(netdev->gas_timeout, netdev);
}
uint32_t netdev_anqp_request(struct netdev *netdev, struct scan_bss *bss, uint32_t netdev_anqp_request(struct netdev *netdev, struct scan_bss *bss,
const uint8_t *anqp, size_t len, const uint8_t *anqp, size_t len,
netdev_anqp_response_func_t cb, netdev_anqp_response_func_t cb,
@ -3607,6 +3644,9 @@ static void netdev_mlme_notify(struct l_genl_msg *msg, void *user_data)
case NL80211_CMD_DEL_STATION: case NL80211_CMD_DEL_STATION:
netdev_station_event(msg, netdev, false); netdev_station_event(msg, netdev, false);
break; break;
case NL80211_CMD_FRAME_WAIT_CANCEL:
netdev_frame_wait_cancel_event(msg, netdev);
break;
} }
} }