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

device: Switch to new frame watch API

This commit is contained in:
Andrew Zaborowski 2020-01-16 03:40:57 +01:00 committed by Denis Kenzior
parent 4a61620a9b
commit b31a23785a

View File

@ -37,6 +37,7 @@
#include "src/scan.h" #include "src/scan.h"
#include "src/netdev.h" #include "src/netdev.h"
#include "src/dbus.h" #include "src/dbus.h"
#include "src/frame-xchg.h"
#include "src/station.h" #include "src/station.h"
struct device { struct device {
@ -48,16 +49,13 @@ struct device {
bool powered : 1; /* Current IFUP state */ bool powered : 1; /* Current IFUP state */
bool dbus_powered : 1; /* Last IFUP state wanted via D-Bus */ bool dbus_powered : 1; /* Last IFUP state wanted via D-Bus */
uint32_t ap_roam_watch;
uint32_t wiphy_rfkill_watch; uint32_t wiphy_rfkill_watch;
}; };
static uint32_t netdev_watch; static uint32_t netdev_watch;
static void device_ap_roam_frame_event(struct netdev *netdev, static void device_ap_roam_frame_event(const struct mmpdu_header *hdr,
const struct mmpdu_header *hdr, const void *body, size_t body_len, int rssi, void *user_data)
const void *body, size_t body_len,
void *user_data)
{ {
struct device *device = user_data; struct device *device = user_data;
struct station *station = station_find(device->index); struct station *station = station_find(device->index);
@ -325,9 +323,9 @@ static struct device *device_create(struct wiphy *wiphy, struct netdev *netdev)
/* /*
* register for AP roam transition watch * register for AP roam transition watch
*/ */
device->ap_roam_watch = netdev_frame_watch_add(netdev, 0x00d0, frame_watch_add(netdev_get_wdev_id(netdev), 0, 0x00d0,
action_ap_roam_prefix, sizeof(action_ap_roam_prefix), action_ap_roam_prefix, sizeof(action_ap_roam_prefix),
device_ap_roam_frame_event, device); device_ap_roam_frame_event, device, NULL);
device->powered = netdev_get_is_up(netdev); device->powered = netdev_get_is_up(netdev);
@ -343,9 +341,16 @@ static void device_free(struct device *device)
{ {
l_debug(""); l_debug("");
netdev_frame_watch_remove(device->netdev, device->ap_roam_watch);
wiphy_state_watch_remove(device->wiphy, device->wiphy_rfkill_watch); wiphy_state_watch_remove(device->wiphy, device->wiphy_rfkill_watch);
/*
* We're triggered on NETDEV_WATCH_EVENT_DEL or device_exit. The former
* is triggered on NL80211_CMD_DEL_INTERFACE and RTM_DELLINK which
* also cause all frame watches to be unregistered so we don't have
* to do this here. device_exit is triggered under the same conditions
* as frame_xchg_exit.
*/
l_free(device); l_free(device);
} }