mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-25 06:00:08 +01:00
platform: Drop nm_platform_wifi_get_{bssid,rate,quality}
These are unused now so remove them and revert most of
e0394689b3 which attempted to fix the same
issue of the platform wifi API not mapping well the nl80211 commands
resulting in redundant netlink commands being used.
In the wext driver there are still three individual getters for the
three values and nm_wifi_utils_get_station() uses either these or the
collective get_station method depending on the driver.
This commit is contained in:
parent
27eba49691
commit
5d4dfcd8d2
6 changed files with 9 additions and 154 deletions
|
|
@ -8281,13 +8281,6 @@ wifi_get_capabilities(NMPlatform *platform, int ifindex, NMDeviceWifiCapabilitie
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
wifi_get_bssid(NMPlatform *platform, int ifindex, guint8 *bssid)
|
||||
{
|
||||
WIFI_GET_WIFI_DATA_NETNS(wifi_data, platform, ifindex, FALSE);
|
||||
return nm_wifi_utils_get_bssid(wifi_data, bssid);
|
||||
}
|
||||
|
||||
static guint32
|
||||
wifi_get_frequency(NMPlatform *platform, int ifindex)
|
||||
{
|
||||
|
|
@ -8295,20 +8288,6 @@ wifi_get_frequency(NMPlatform *platform, int ifindex)
|
|||
return nm_wifi_utils_get_freq(wifi_data);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
wifi_get_quality(NMPlatform *platform, int ifindex)
|
||||
{
|
||||
WIFI_GET_WIFI_DATA_NETNS(wifi_data, platform, ifindex, FALSE);
|
||||
return nm_wifi_utils_get_qual(wifi_data);
|
||||
}
|
||||
|
||||
static guint32
|
||||
wifi_get_rate(NMPlatform *platform, int ifindex)
|
||||
{
|
||||
WIFI_GET_WIFI_DATA_NETNS(wifi_data, platform, ifindex, FALSE);
|
||||
return nm_wifi_utils_get_rate(wifi_data);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
wifi_get_station(NMPlatform *platform,
|
||||
int ifindex,
|
||||
|
|
@ -9680,10 +9659,7 @@ nm_linux_platform_class_init(NMLinuxPlatformClass *klass)
|
|||
platform_class->infiniband_partition_delete = infiniband_partition_delete;
|
||||
|
||||
platform_class->wifi_get_capabilities = wifi_get_capabilities;
|
||||
platform_class->wifi_get_bssid = wifi_get_bssid;
|
||||
platform_class->wifi_get_frequency = wifi_get_frequency;
|
||||
platform_class->wifi_get_quality = wifi_get_quality;
|
||||
platform_class->wifi_get_rate = wifi_get_rate;
|
||||
platform_class->wifi_get_station = wifi_get_station;
|
||||
platform_class->wifi_get_mode = wifi_get_mode;
|
||||
platform_class->wifi_set_mode = wifi_set_mode;
|
||||
|
|
|
|||
|
|
@ -3051,16 +3051,6 @@ nm_platform_wifi_get_capabilities(NMPlatform *self, int ifindex, NMDeviceWifiCap
|
|||
return klass->wifi_get_capabilities(self, ifindex, caps);
|
||||
}
|
||||
|
||||
gboolean
|
||||
nm_platform_wifi_get_bssid(NMPlatform *self, int ifindex, guint8 *bssid)
|
||||
{
|
||||
_CHECK_SELF(self, klass, FALSE);
|
||||
|
||||
g_return_val_if_fail(ifindex > 0, FALSE);
|
||||
|
||||
return klass->wifi_get_bssid(self, ifindex, bssid);
|
||||
}
|
||||
|
||||
guint32
|
||||
nm_platform_wifi_get_frequency(NMPlatform *self, int ifindex)
|
||||
{
|
||||
|
|
@ -3071,26 +3061,6 @@ nm_platform_wifi_get_frequency(NMPlatform *self, int ifindex)
|
|||
return klass->wifi_get_frequency(self, ifindex);
|
||||
}
|
||||
|
||||
int
|
||||
nm_platform_wifi_get_quality(NMPlatform *self, int ifindex)
|
||||
{
|
||||
_CHECK_SELF(self, klass, 0);
|
||||
|
||||
g_return_val_if_fail(ifindex > 0, 0);
|
||||
|
||||
return klass->wifi_get_quality(self, ifindex);
|
||||
}
|
||||
|
||||
guint32
|
||||
nm_platform_wifi_get_rate(NMPlatform *self, int ifindex)
|
||||
{
|
||||
_CHECK_SELF(self, klass, 0);
|
||||
|
||||
g_return_val_if_fail(ifindex > 0, 0);
|
||||
|
||||
return klass->wifi_get_rate(self, ifindex);
|
||||
}
|
||||
|
||||
gboolean
|
||||
nm_platform_wifi_get_station(NMPlatform *self,
|
||||
int ifindex,
|
||||
|
|
|
|||
|
|
@ -1967,10 +1967,7 @@ gboolean nm_platform_link_tun_get_properties(NMPlatform * self,
|
|||
|
||||
gboolean
|
||||
nm_platform_wifi_get_capabilities(NMPlatform *self, int ifindex, NMDeviceWifiCapabilities *caps);
|
||||
gboolean nm_platform_wifi_get_bssid(NMPlatform *self, int ifindex, guint8 *bssid);
|
||||
guint32 nm_platform_wifi_get_frequency(NMPlatform *self, int ifindex);
|
||||
int nm_platform_wifi_get_quality(NMPlatform *self, int ifindex);
|
||||
guint32 nm_platform_wifi_get_rate(NMPlatform *self, int ifindex);
|
||||
gboolean nm_platform_wifi_get_station(NMPlatform *self,
|
||||
int ifindex,
|
||||
guint8 * out_bssid,
|
||||
|
|
|
|||
|
|
@ -41,16 +41,6 @@
|
|||
} \
|
||||
G_STMT_END
|
||||
|
||||
struct nl80211_station_info {
|
||||
gboolean valid;
|
||||
guint8 bssid[ETH_ALEN];
|
||||
guint32 txrate;
|
||||
gboolean txrate_valid;
|
||||
guint8 signal;
|
||||
gboolean signal_valid;
|
||||
gint64 timestamp;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
NMWifiUtils parent;
|
||||
struct nl_sock *nl_sock;
|
||||
|
|
@ -59,8 +49,6 @@ typedef struct {
|
|||
int num_freqs;
|
||||
int phy;
|
||||
bool can_wowlan : 1;
|
||||
|
||||
struct nl80211_station_info sta_info;
|
||||
} NMWifiUtilsNl80211;
|
||||
|
||||
typedef struct {
|
||||
|
|
@ -422,6 +410,15 @@ nl80211_xbm_to_percent(gint32 xbm, guint32 divisor)
|
|||
/ ((float) SIGNAL_MAX_DBM - (float) NOISE_FLOOR_DBM));
|
||||
}
|
||||
|
||||
struct nl80211_station_info {
|
||||
gboolean valid;
|
||||
guint8 bssid[ETH_ALEN];
|
||||
guint32 txrate;
|
||||
gboolean txrate_valid;
|
||||
guint8 signal;
|
||||
gboolean signal_valid;
|
||||
};
|
||||
|
||||
static int
|
||||
nl80211_station_dump_handler(struct nl_msg *msg, void *arg)
|
||||
{
|
||||
|
|
@ -496,55 +493,6 @@ nl80211_station_dump_handler(struct nl_msg *msg, void *arg)
|
|||
return NL_SKIP;
|
||||
}
|
||||
|
||||
static void
|
||||
nl80211_get_sta_info(NMWifiUtilsNl80211 *self)
|
||||
{
|
||||
nm_auto_nlmsg struct nl_msg *msg = NULL;
|
||||
gint64 now = nm_utils_get_monotonic_timestamp_msec();
|
||||
|
||||
if (self->sta_info.valid && now - self->sta_info.timestamp < 500)
|
||||
return;
|
||||
|
||||
memset(&self->sta_info, 0, sizeof(self->sta_info));
|
||||
|
||||
msg = nl80211_alloc_msg(self, NL80211_CMD_GET_STATION, NLM_F_DUMP);
|
||||
|
||||
nl80211_send_and_recv(self, msg, nl80211_station_dump_handler, &self->sta_info);
|
||||
self->sta_info.timestamp = now;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
wifi_nl80211_get_bssid(NMWifiUtils *data, guint8 *out_bssid)
|
||||
{
|
||||
NMWifiUtilsNl80211 *self = (NMWifiUtilsNl80211 *) data;
|
||||
|
||||
nl80211_get_sta_info(self);
|
||||
|
||||
if (self->sta_info.valid)
|
||||
memcpy(out_bssid, self->sta_info.bssid, ETH_ALEN);
|
||||
|
||||
return self->sta_info.valid;
|
||||
}
|
||||
|
||||
static guint32
|
||||
wifi_nl80211_get_rate(NMWifiUtils *data)
|
||||
{
|
||||
NMWifiUtilsNl80211 *self = (NMWifiUtilsNl80211 *) data;
|
||||
|
||||
nl80211_get_sta_info(self);
|
||||
|
||||
return self->sta_info.txrate;
|
||||
}
|
||||
|
||||
static int
|
||||
wifi_nl80211_get_qual(NMWifiUtils *data)
|
||||
{
|
||||
NMWifiUtilsNl80211 *self = (NMWifiUtilsNl80211 *) data;
|
||||
|
||||
nl80211_get_sta_info(self);
|
||||
return self->sta_info.signal;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
wifi_nl80211_get_station(NMWifiUtils *data, guint8 *out_bssid, int *out_quality, guint32 *out_rate)
|
||||
{
|
||||
|
|
@ -884,9 +832,6 @@ nm_wifi_utils_nl80211_class_init(NMWifiUtilsNl80211Class *klass)
|
|||
wifi_utils_class->set_wake_on_wlan = wifi_nl80211_set_wake_on_wlan,
|
||||
wifi_utils_class->get_freq = wifi_nl80211_get_freq;
|
||||
wifi_utils_class->find_freq = wifi_nl80211_find_freq;
|
||||
wifi_utils_class->get_bssid = wifi_nl80211_get_bssid;
|
||||
wifi_utils_class->get_rate = wifi_nl80211_get_rate;
|
||||
wifi_utils_class->get_qual = wifi_nl80211_get_qual;
|
||||
wifi_utils_class->get_station = wifi_nl80211_get_station;
|
||||
wifi_utils_class->indicate_addressing_running = wifi_nl80211_indicate_addressing_running;
|
||||
wifi_utils_class->get_mesh_channel = wifi_nl80211_get_mesh_channel;
|
||||
|
|
|
|||
|
|
@ -131,30 +131,6 @@ nm_wifi_utils_find_freq(NMWifiUtils *data, const guint32 *freqs)
|
|||
return NM_WIFI_UTILS_GET_CLASS(data)->find_freq(data, freqs);
|
||||
}
|
||||
|
||||
gboolean
|
||||
nm_wifi_utils_get_bssid(NMWifiUtils *data, guint8 *out_bssid)
|
||||
{
|
||||
g_return_val_if_fail(data != NULL, FALSE);
|
||||
g_return_val_if_fail(out_bssid != NULL, FALSE);
|
||||
|
||||
memset(out_bssid, 0, ETH_ALEN);
|
||||
return NM_WIFI_UTILS_GET_CLASS(data)->get_bssid(data, out_bssid);
|
||||
}
|
||||
|
||||
guint32
|
||||
nm_wifi_utils_get_rate(NMWifiUtils *data)
|
||||
{
|
||||
g_return_val_if_fail(data != NULL, 0);
|
||||
return NM_WIFI_UTILS_GET_CLASS(data)->get_rate(data);
|
||||
}
|
||||
|
||||
int
|
||||
nm_wifi_utils_get_qual(NMWifiUtils *data)
|
||||
{
|
||||
g_return_val_if_fail(data != NULL, 0);
|
||||
return NM_WIFI_UTILS_GET_CLASS(data)->get_qual(data);
|
||||
}
|
||||
|
||||
gboolean
|
||||
nm_wifi_utils_get_station(NMWifiUtils *data, guint8 *out_bssid, int *out_quality, guint32 *out_rate)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -43,15 +43,6 @@ guint32 nm_wifi_utils_get_freq(NMWifiUtils *data);
|
|||
* Frequencies are specified in MHz. */
|
||||
guint32 nm_wifi_utils_find_freq(NMWifiUtils *data, const guint32 *freqs);
|
||||
|
||||
/* out_bssid must be ETH_ALEN bytes */
|
||||
gboolean nm_wifi_utils_get_bssid(NMWifiUtils *data, guint8 *out_bssid);
|
||||
|
||||
/* Returns current bitrate in Kbps */
|
||||
guint32 nm_wifi_utils_get_rate(NMWifiUtils *data);
|
||||
|
||||
/* Returns quality 0 - 100% on success, or -1 on error */
|
||||
int nm_wifi_utils_get_qual(NMWifiUtils *data);
|
||||
|
||||
/*
|
||||
* @out_bssid: must be NULL or an ETH_ALEN-byte buffer
|
||||
* @out_quality: receives signal quality in 0 - 100% range if not NULL
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue