diff options
author | Sven Eckelmann <sven.eckelmann@open-mesh.com> | 2016-09-30 15:21:03 +0200 |
---|---|---|
committer | Simon Wunderlich <sw@simonwunderlich.de> | 2016-11-08 19:02:37 +0100 |
commit | 10b1bbb46c6c8e571458a9a8913514dbebbaf20c (patch) | |
tree | d6485a43f41c5867811004a8766eaafc3a56ce3f /net/batman-adv/bat_v_elp.c | |
parent | f44a3ae9a2811cfd5321e0f72c02bc270410db64 (diff) | |
download | lwn-10b1bbb46c6c8e571458a9a8913514dbebbaf20c.tar.gz lwn-10b1bbb46c6c8e571458a9a8913514dbebbaf20c.zip |
batman-adv: Cache the type of wifi device for each hardif
batman-adv is requiring the type of wifi device in different contexts. Some
of them can take the rtnl semaphore and some of them already have the
semaphore taken. But even others don't allow that the semaphore will be
taken.
The data has to be retrieved when the hardif is added to batman-adv because
some of the wifi information for an hardif will only be available with rtnl
lock. It can then be cached in the batadv_hard_iface and the functions
is_wifi_netdev and is_cfg80211_netdev can just compare the correct bits
without imposing extra locking requirements.
Signed-off-by: Sven Eckelmann <sven.eckelmann@open-mesh.com>
Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
Diffstat (limited to 'net/batman-adv/bat_v_elp.c')
-rw-r--r-- | net/batman-adv/bat_v_elp.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/net/batman-adv/bat_v_elp.c b/net/batman-adv/bat_v_elp.c index e601def12aec..0d7868912253 100644 --- a/net/batman-adv/bat_v_elp.c +++ b/net/batman-adv/bat_v_elp.c @@ -89,8 +89,8 @@ static u32 batadv_v_elp_get_throughput(struct batadv_hardif_neigh_node *neigh) /* if this is a wireless device, then ask its throughput through * cfg80211 API */ - if (batadv_is_wifi_netdev(hard_iface->net_dev)) { - if (!batadv_is_cfg80211_netdev(hard_iface->net_dev)) + if (batadv_is_wifi_hardif(hard_iface)) { + if (!batadv_is_cfg80211_hardif(hard_iface)) /* unsupported WiFi driver version */ goto default_throughput; @@ -186,7 +186,7 @@ batadv_v_elp_wifi_neigh_probe(struct batadv_hardif_neigh_node *neigh) int elp_skb_len; /* this probing routine is for Wifi neighbours only */ - if (!batadv_is_wifi_netdev(hard_iface->net_dev)) + if (!batadv_is_wifi_hardif(hard_iface)) return true; /* probe the neighbor only if no unicast packets have been sent @@ -351,7 +351,7 @@ int batadv_v_elp_iface_enable(struct batadv_hard_iface *hard_iface) /* warn the user (again) if there is no throughput data is available */ hard_iface->bat_v.flags &= ~BATADV_WARNING_DEFAULT; - if (batadv_is_wifi_netdev(hard_iface->net_dev)) + if (batadv_is_wifi_hardif(hard_iface)) hard_iface->bat_v.flags &= ~BATADV_FULL_DUPLEX; INIT_DELAYED_WORK(&hard_iface->bat_v.elp_wq, |