Commit fb8ddaa9 authored by David S. Miller's avatar David S. Miller

Merge tag 'batadv-next-for-davem-20200526' of git://git.open-mesh.org/linux-merge

Simon Wunderlich says:

====================
This cleanup patchset includes the following patches:

 - Fix revert dynamic lockdep key changes for batman-adv,
   by Sven Eckelmann

 - use rcu_replace_pointer() where appropriate, by Antonio Quartulli

 - Revert "disable ethtool link speed detection when auto negotiation
   off", by Sven Eckelmann
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 6a862a44 9ad346c9
...@@ -127,20 +127,7 @@ static u32 batadv_v_elp_get_throughput(struct batadv_hardif_neigh_node *neigh) ...@@ -127,20 +127,7 @@ static u32 batadv_v_elp_get_throughput(struct batadv_hardif_neigh_node *neigh)
rtnl_lock(); rtnl_lock();
ret = __ethtool_get_link_ksettings(hard_iface->net_dev, &link_settings); ret = __ethtool_get_link_ksettings(hard_iface->net_dev, &link_settings);
rtnl_unlock(); rtnl_unlock();
if (ret == 0) {
/* Virtual interface drivers such as tun / tap interfaces, VLAN, etc
* tend to initialize the interface throughput with some value for the
* sake of having a throughput number to export via ethtool. This
* exported throughput leaves batman-adv to conclude the interface
* throughput is genuine (reflecting reality), thus no measurements
* are necessary.
*
* Based on the observation that those interface types also tend to set
* the link auto-negotiation to 'off', batman-adv shall check this
* setting to differentiate between genuine link throughput information
* and placeholders installed by virtual interfaces.
*/
if (ret == 0 && link_settings.base.autoneg == AUTONEG_ENABLE) {
/* link characteristics might change over time */ /* link characteristics might change over time */
if (link_settings.base.duplex == DUPLEX_FULL) if (link_settings.base.duplex == DUPLEX_FULL)
hard_iface->bat_v.flags |= BATADV_FULL_DUPLEX; hard_iface->bat_v.flags |= BATADV_FULL_DUPLEX;
......
...@@ -146,8 +146,8 @@ static void batadv_gw_select(struct batadv_priv *bat_priv, ...@@ -146,8 +146,8 @@ static void batadv_gw_select(struct batadv_priv *bat_priv,
if (new_gw_node) if (new_gw_node)
kref_get(&new_gw_node->refcount); kref_get(&new_gw_node->refcount);
curr_gw_node = rcu_dereference_protected(bat_priv->gw.curr_gw, 1); curr_gw_node = rcu_replace_pointer(bat_priv->gw.curr_gw, new_gw_node,
rcu_assign_pointer(bat_priv->gw.curr_gw, new_gw_node); true);
if (curr_gw_node) if (curr_gw_node)
batadv_gw_node_put(curr_gw_node); batadv_gw_node_put(curr_gw_node);
......
...@@ -473,8 +473,8 @@ static void batadv_primary_if_select(struct batadv_priv *bat_priv, ...@@ -473,8 +473,8 @@ static void batadv_primary_if_select(struct batadv_priv *bat_priv,
if (new_hard_iface) if (new_hard_iface)
kref_get(&new_hard_iface->refcount); kref_get(&new_hard_iface->refcount);
curr_hard_iface = rcu_dereference_protected(bat_priv->primary_if, 1); curr_hard_iface = rcu_replace_pointer(bat_priv->primary_if,
rcu_assign_pointer(bat_priv->primary_if, new_hard_iface); new_hard_iface, 1);
if (!new_hard_iface) if (!new_hard_iface)
goto out; goto out;
......
...@@ -71,13 +71,13 @@ static void _batadv_update_route(struct batadv_priv *bat_priv, ...@@ -71,13 +71,13 @@ static void _batadv_update_route(struct batadv_priv *bat_priv,
* the code needs to ensure the curr_router variable contains a pointer * the code needs to ensure the curr_router variable contains a pointer
* to the replaced best neighbor. * to the replaced best neighbor.
*/ */
curr_router = rcu_dereference_protected(orig_ifinfo->router, true);
/* increase refcount of new best neighbor */ /* increase refcount of new best neighbor */
if (neigh_node) if (neigh_node)
kref_get(&neigh_node->refcount); kref_get(&neigh_node->refcount);
rcu_assign_pointer(orig_ifinfo->router, neigh_node); curr_router = rcu_replace_pointer(orig_ifinfo->router, neigh_node,
true);
spin_unlock_bh(&orig_node->neigh_list_lock); spin_unlock_bh(&orig_node->neigh_list_lock);
batadv_orig_ifinfo_put(orig_ifinfo); batadv_orig_ifinfo_put(orig_ifinfo);
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/kref.h> #include <linux/kref.h>
#include <linux/list.h> #include <linux/list.h>
#include <linux/lockdep.h>
#include <linux/netdevice.h> #include <linux/netdevice.h>
#include <linux/netlink.h> #include <linux/netlink.h>
#include <linux/percpu.h> #include <linux/percpu.h>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment