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
1 changed files with 13 additions and 8 deletions

View File

@ -37,6 +37,7 @@
#include "src/scan.h"
#include "src/netdev.h"
#include "src/dbus.h"
#include "src/frame-xchg.h"
#include "src/station.h"
struct device {
@ -48,16 +49,13 @@ struct device {
bool powered : 1; /* Current IFUP state */
bool dbus_powered : 1; /* Last IFUP state wanted via D-Bus */
uint32_t ap_roam_watch;
uint32_t wiphy_rfkill_watch;
};
static uint32_t netdev_watch;
static void device_ap_roam_frame_event(struct netdev *netdev,
const struct mmpdu_header *hdr,
const void *body, size_t body_len,
void *user_data)
static void device_ap_roam_frame_event(const struct mmpdu_header *hdr,
const void *body, size_t body_len, int rssi, void *user_data)
{
struct device *device = user_data;
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
*/
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),
device_ap_roam_frame_event, device);
device_ap_roam_frame_event, device, NULL);
device->powered = netdev_get_is_up(netdev);
@ -343,9 +341,16 @@ static void device_free(struct device *device)
{
l_debug("");
netdev_frame_watch_remove(device->netdev, device->ap_roam_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);
}