mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-11-26 18:59:22 +01:00
scan: Refactor scheduled scan code to scan.c
Move the implementation details of triggering scheduled wifi scans over netlink to scan.c from wiphy.c. No functionality is affected by this commit.
This commit is contained in:
parent
35d0c519d7
commit
f73708e1d7
20
src/scan.c
20
src/scan.c
@ -47,3 +47,23 @@ void scan_start(struct l_genl_family *nl80211, uint32_t ifindex,
|
|||||||
l_genl_family_send(nl80211, msg, callback, user_data, NULL);
|
l_genl_family_send(nl80211, msg, callback, user_data, NULL);
|
||||||
l_genl_msg_unref(msg);
|
l_genl_msg_unref(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void scan_sched_start(struct l_genl_family *nl80211, uint32_t ifindex,
|
||||||
|
uint32_t scan_interval,
|
||||||
|
scan_func_t callback, void *user_data)
|
||||||
|
{
|
||||||
|
struct l_genl_msg *msg;
|
||||||
|
|
||||||
|
scan_interval *= 1000; /* in kernel the interval is in msecs */
|
||||||
|
|
||||||
|
msg = l_genl_msg_new_sized(NL80211_CMD_START_SCHED_SCAN, 32);
|
||||||
|
l_genl_msg_append_attr(msg, NL80211_ATTR_IFINDEX, 4, &ifindex);
|
||||||
|
l_genl_msg_append_attr(msg, NL80211_ATTR_SCHED_SCAN_INTERVAL,
|
||||||
|
4, &scan_interval);
|
||||||
|
l_genl_msg_append_attr(msg, NL80211_ATTR_SOCKET_OWNER, 0, NULL);
|
||||||
|
|
||||||
|
if (!l_genl_family_send(nl80211, msg, callback, user_data, NULL))
|
||||||
|
l_error("Starting scheduled scan failed");
|
||||||
|
|
||||||
|
l_genl_msg_unref(msg);
|
||||||
|
}
|
||||||
|
@ -24,3 +24,7 @@ typedef void (*scan_func_t)(struct l_genl_msg *msg, void *user_data);
|
|||||||
|
|
||||||
void scan_start(struct l_genl_family *nl80211, uint32_t ifindex,
|
void scan_start(struct l_genl_family *nl80211, uint32_t ifindex,
|
||||||
scan_func_t callback, void *user_data);
|
scan_func_t callback, void *user_data);
|
||||||
|
|
||||||
|
void scan_sched_start(struct l_genl_family *nl80211, uint32_t ifindex,
|
||||||
|
uint32_t scan_interval, scan_func_t callback,
|
||||||
|
void *user_data);
|
||||||
|
16
src/wiphy.c
16
src/wiphy.c
@ -769,8 +769,6 @@ done:
|
|||||||
static void setup_scheduled_scan(struct wiphy *wiphy, struct netdev *netdev,
|
static void setup_scheduled_scan(struct wiphy *wiphy, struct netdev *netdev,
|
||||||
uint32_t scan_interval)
|
uint32_t scan_interval)
|
||||||
{
|
{
|
||||||
struct l_genl_msg *msg;
|
|
||||||
|
|
||||||
if (!wiphy->support_scheduled_scan) {
|
if (!wiphy->support_scheduled_scan) {
|
||||||
l_debug("Scheduled scan not supported for %s "
|
l_debug("Scheduled scan not supported for %s "
|
||||||
"iface %s ifindex %u", wiphy->name, netdev->name,
|
"iface %s ifindex %u", wiphy->name, netdev->name,
|
||||||
@ -778,18 +776,8 @@ static void setup_scheduled_scan(struct wiphy *wiphy, struct netdev *netdev,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
scan_interval *= 1000; /* in kernel the interval is in msecs */
|
scan_sched_start(nl80211, netdev->index, scan_interval,
|
||||||
|
sched_scan_callback, netdev);
|
||||||
msg = l_genl_msg_new_sized(NL80211_CMD_START_SCHED_SCAN, 32);
|
|
||||||
msg_append_attr(msg, NL80211_ATTR_IFINDEX, 4, &netdev->index);
|
|
||||||
msg_append_attr(msg, NL80211_ATTR_SCHED_SCAN_INTERVAL,
|
|
||||||
4, &scan_interval);
|
|
||||||
msg_append_attr(msg, NL80211_ATTR_SOCKET_OWNER, 0, NULL);
|
|
||||||
|
|
||||||
if (!l_genl_family_send(nl80211, msg, sched_scan_callback, NULL, NULL))
|
|
||||||
l_error("Starting scheduled scan failed");
|
|
||||||
|
|
||||||
l_genl_msg_unref(msg);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void interface_dump_callback(struct l_genl_msg *msg, void *user_data)
|
static void interface_dump_callback(struct l_genl_msg *msg, void *user_data)
|
||||||
|
Loading…
Reference in New Issue
Block a user