commit baf6b3ee4d602fc81f1a118c97d49152d6bd3874
parent 1e33eaa072c8b2b2b6d1e9d8b6b03dbccf489905
Author: James Prestwood <james.prestwood@linux.intel.com>
Date: Fri, 14 Jun 2019 14:56:14 -0700
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.
Diffstat:
1 file changed, 40 insertions(+), 0 deletions(-)
diff --git a/src/netdev.c b/src/netdev.c
@@ -2874,6 +2874,43 @@ static void netdev_gas_timeout_cb(struct l_timeout *timeout, void *user_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,
const uint8_t *anqp, size_t len,
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:
netdev_station_event(msg, netdev, false);
break;
+ case NL80211_CMD_FRAME_WAIT_CANCEL:
+ netdev_frame_wait_cancel_event(msg, netdev);
+ break;
}
}