Commit 5c352421 authored by David S. Miller's avatar David S. Miller

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

Simon Wunderlich says:

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

 - bump version strings, by Simon Wunderlich

 - Disable batman-adv debugfs by default, by Sven Eckelmann

 - Improve handling mesh nodes with multicast optimizations disabled,
   by Linus Luessing

 - Avoid bool in structs, by Sven Eckelmann

 - Allocate less memory when debugfs is disabled, by Sven Eckelmann

 - Fix batadv_interface_tx return data type, by Luc Van Oostenryck

 - improve link speed handling for virtual interfaces, by Marek Lindner

 - Enable BATMAN V algorithm by default, by Marek Lindner
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 13405468 18cfb44c
...@@ -35,7 +35,7 @@ config BATMAN_ADV ...@@ -35,7 +35,7 @@ config BATMAN_ADV
config BATMAN_ADV_BATMAN_V config BATMAN_ADV_BATMAN_V
bool "B.A.T.M.A.N. V protocol (experimental)" bool "B.A.T.M.A.N. V protocol (experimental)"
depends on BATMAN_ADV && !(CFG80211=m && BATMAN_ADV=y) depends on BATMAN_ADV && !(CFG80211=m && BATMAN_ADV=y)
default n default y
help help
This option enables the B.A.T.M.A.N. V protocol, the successor This option enables the B.A.T.M.A.N. V protocol, the successor
of the currently used B.A.T.M.A.N. IV protocol. The main of the currently used B.A.T.M.A.N. IV protocol. The main
...@@ -94,13 +94,13 @@ config BATMAN_ADV_DEBUGFS ...@@ -94,13 +94,13 @@ config BATMAN_ADV_DEBUGFS
bool "batman-adv debugfs entries" bool "batman-adv debugfs entries"
depends on BATMAN_ADV depends on BATMAN_ADV
depends on DEBUG_FS depends on DEBUG_FS
default y default n
help help
Enable this to export routing related debug tables via debugfs. Enable this to export routing related debug tables via debugfs.
The information for each soft-interface and used hard-interface can be The information for each soft-interface and used hard-interface can be
found under batman_adv/ found under batman_adv/
If unsure, say Y. If unsure, say N.
config BATMAN_ADV_DEBUG config BATMAN_ADV_DEBUG
bool "B.A.T.M.A.N. debugging" bool "B.A.T.M.A.N. debugging"
......
...@@ -127,7 +127,20 @@ static u32 batadv_v_elp_get_throughput(struct batadv_hardif_neigh_node *neigh) ...@@ -127,7 +127,20 @@ 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;
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
#define BATADV_DRIVER_DEVICE "batman-adv" #define BATADV_DRIVER_DEVICE "batman-adv"
#ifndef BATADV_SOURCE_VERSION #ifndef BATADV_SOURCE_VERSION
#define BATADV_SOURCE_VERSION "2018.1" #define BATADV_SOURCE_VERSION "2018.2"
#endif #endif
/* B.A.T.M.A.N. parameters */ /* B.A.T.M.A.N. parameters */
......
...@@ -815,9 +815,6 @@ static int batadv_mcast_forw_mode_check(struct batadv_priv *bat_priv, ...@@ -815,9 +815,6 @@ static int batadv_mcast_forw_mode_check(struct batadv_priv *bat_priv,
if (!atomic_read(&bat_priv->multicast_mode)) if (!atomic_read(&bat_priv->multicast_mode))
return -EINVAL; return -EINVAL;
if (atomic_read(&bat_priv->mcast.num_disabled))
return -EINVAL;
switch (ntohs(ethhdr->h_proto)) { switch (ntohs(ethhdr->h_proto)) {
case ETH_P_IP: case ETH_P_IP:
return batadv_mcast_forw_mode_check_ipv4(bat_priv, skb, return batadv_mcast_forw_mode_check_ipv4(bat_priv, skb,
...@@ -1183,33 +1180,23 @@ static void batadv_mcast_tvlv_ogm_handler(struct batadv_priv *bat_priv, ...@@ -1183,33 +1180,23 @@ static void batadv_mcast_tvlv_ogm_handler(struct batadv_priv *bat_priv,
{ {
bool orig_mcast_enabled = !(flags & BATADV_TVLV_HANDLER_OGM_CIFNOTFND); bool orig_mcast_enabled = !(flags & BATADV_TVLV_HANDLER_OGM_CIFNOTFND);
u8 mcast_flags = BATADV_NO_FLAGS; u8 mcast_flags = BATADV_NO_FLAGS;
bool orig_initialized;
if (orig_mcast_enabled && tvlv_value && if (orig_mcast_enabled && tvlv_value &&
tvlv_value_len >= sizeof(mcast_flags)) tvlv_value_len >= sizeof(mcast_flags))
mcast_flags = *(u8 *)tvlv_value; mcast_flags = *(u8 *)tvlv_value;
if (!orig_mcast_enabled) {
mcast_flags |= BATADV_MCAST_WANT_ALL_IPV4;
mcast_flags |= BATADV_MCAST_WANT_ALL_IPV6;
}
spin_lock_bh(&orig->mcast_handler_lock); spin_lock_bh(&orig->mcast_handler_lock);
orig_initialized = test_bit(BATADV_ORIG_CAPA_HAS_MCAST,
&orig->capa_initialized);
/* If mcast support is turned on decrease the disabled mcast node
* counter only if we had increased it for this node before. If this
* is a completely new orig_node no need to decrease the counter.
*/
if (orig_mcast_enabled && if (orig_mcast_enabled &&
!test_bit(BATADV_ORIG_CAPA_HAS_MCAST, &orig->capabilities)) { !test_bit(BATADV_ORIG_CAPA_HAS_MCAST, &orig->capabilities)) {
if (orig_initialized)
atomic_dec(&bat_priv->mcast.num_disabled);
set_bit(BATADV_ORIG_CAPA_HAS_MCAST, &orig->capabilities); set_bit(BATADV_ORIG_CAPA_HAS_MCAST, &orig->capabilities);
/* If mcast support is being switched off or if this is an initial
* OGM without mcast support then increase the disabled mcast
* node counter.
*/
} else if (!orig_mcast_enabled && } else if (!orig_mcast_enabled &&
(test_bit(BATADV_ORIG_CAPA_HAS_MCAST, &orig->capabilities) || test_bit(BATADV_ORIG_CAPA_HAS_MCAST, &orig->capabilities)) {
!orig_initialized)) {
atomic_inc(&bat_priv->mcast.num_disabled);
clear_bit(BATADV_ORIG_CAPA_HAS_MCAST, &orig->capabilities); clear_bit(BATADV_ORIG_CAPA_HAS_MCAST, &orig->capabilities);
} }
...@@ -1595,10 +1582,6 @@ void batadv_mcast_purge_orig(struct batadv_orig_node *orig) ...@@ -1595,10 +1582,6 @@ void batadv_mcast_purge_orig(struct batadv_orig_node *orig)
spin_lock_bh(&orig->mcast_handler_lock); spin_lock_bh(&orig->mcast_handler_lock);
if (!test_bit(BATADV_ORIG_CAPA_HAS_MCAST, &orig->capabilities) &&
test_bit(BATADV_ORIG_CAPA_HAS_MCAST, &orig->capa_initialized))
atomic_dec(&bat_priv->mcast.num_disabled);
batadv_mcast_want_unsnoop_update(bat_priv, orig, BATADV_NO_FLAGS); batadv_mcast_want_unsnoop_update(bat_priv, orig, BATADV_NO_FLAGS);
batadv_mcast_want_ipv4_update(bat_priv, orig, BATADV_NO_FLAGS); batadv_mcast_want_ipv4_update(bat_priv, orig, BATADV_NO_FLAGS);
batadv_mcast_want_ipv6_update(bat_priv, orig, BATADV_NO_FLAGS); batadv_mcast_want_ipv6_update(bat_priv, orig, BATADV_NO_FLAGS);
......
...@@ -188,8 +188,8 @@ static void batadv_interface_set_rx_mode(struct net_device *dev) ...@@ -188,8 +188,8 @@ static void batadv_interface_set_rx_mode(struct net_device *dev)
{ {
} }
static int batadv_interface_tx(struct sk_buff *skb, static netdev_tx_t batadv_interface_tx(struct sk_buff *skb,
struct net_device *soft_iface) struct net_device *soft_iface)
{ {
struct ethhdr *ethhdr; struct ethhdr *ethhdr;
struct batadv_priv *bat_priv = netdev_priv(soft_iface); struct batadv_priv *bat_priv = netdev_priv(soft_iface);
...@@ -796,7 +796,6 @@ static int batadv_softif_init_late(struct net_device *dev) ...@@ -796,7 +796,6 @@ static int batadv_softif_init_late(struct net_device *dev)
bat_priv->mcast.querier_ipv6.shadowing = false; bat_priv->mcast.querier_ipv6.shadowing = false;
bat_priv->mcast.flags = BATADV_NO_FLAGS; bat_priv->mcast.flags = BATADV_NO_FLAGS;
atomic_set(&bat_priv->multicast_mode, 1); atomic_set(&bat_priv->multicast_mode, 1);
atomic_set(&bat_priv->mcast.num_disabled, 0);
atomic_set(&bat_priv->mcast.num_want_all_unsnoopables, 0); atomic_set(&bat_priv->mcast.num_want_all_unsnoopables, 0);
atomic_set(&bat_priv->mcast.num_want_all_ipv4, 0); atomic_set(&bat_priv->mcast.num_want_all_ipv4, 0);
atomic_set(&bat_priv->mcast.num_want_all_ipv6, 0); atomic_set(&bat_priv->mcast.num_want_all_ipv6, 0);
......
...@@ -215,10 +215,12 @@ struct batadv_hard_iface { ...@@ -215,10 +215,12 @@ struct batadv_hard_iface {
struct batadv_hard_iface_bat_v bat_v; struct batadv_hard_iface_bat_v bat_v;
#endif #endif
#ifdef CONFIG_BATMAN_ADV_DEBUGFS
/** /**
* @debug_dir: dentry for nc subdir in batman-adv directory in debugfs * @debug_dir: dentry for nc subdir in batman-adv directory in debugfs
*/ */
struct dentry *debug_dir; struct dentry *debug_dir;
#endif
/** /**
* @neigh_list: list of unique single hop neighbors via this interface * @neigh_list: list of unique single hop neighbors via this interface
...@@ -1160,13 +1162,13 @@ struct batadv_priv_dat { ...@@ -1160,13 +1162,13 @@ struct batadv_priv_dat {
*/ */
struct batadv_mcast_querier_state { struct batadv_mcast_querier_state {
/** @exists: whether a querier exists in the mesh */ /** @exists: whether a querier exists in the mesh */
bool exists; unsigned char exists:1;
/** /**
* @shadowing: if a querier exists, whether it is potentially shadowing * @shadowing: if a querier exists, whether it is potentially shadowing
* multicast listeners (i.e. querier is behind our own bridge segment) * multicast listeners (i.e. querier is behind our own bridge segment)
*/ */
bool shadowing; unsigned char shadowing:1;
}; };
/** /**
...@@ -1207,13 +1209,10 @@ struct batadv_priv_mcast { ...@@ -1207,13 +1209,10 @@ struct batadv_priv_mcast {
u8 flags; u8 flags;
/** @enabled: whether the multicast tvlv is currently enabled */ /** @enabled: whether the multicast tvlv is currently enabled */
bool enabled; unsigned char enabled:1;
/** @bridged: whether the soft interface has a bridge on top */ /** @bridged: whether the soft interface has a bridge on top */
bool bridged; unsigned char bridged:1;
/** @num_disabled: number of nodes that have no mcast tvlv */
atomic_t num_disabled;
/** /**
* @num_want_all_unsnoopables: number of nodes wanting unsnoopable IP * @num_want_all_unsnoopables: number of nodes wanting unsnoopable IP
...@@ -1245,10 +1244,12 @@ struct batadv_priv_nc { ...@@ -1245,10 +1244,12 @@ struct batadv_priv_nc {
/** @work: work queue callback item for cleanup */ /** @work: work queue callback item for cleanup */
struct delayed_work work; struct delayed_work work;
#ifdef CONFIG_BATMAN_ADV_DEBUGFS
/** /**
* @debug_dir: dentry for nc subdir in batman-adv directory in debugfs * @debug_dir: dentry for nc subdir in batman-adv directory in debugfs
*/ */
struct dentry *debug_dir; struct dentry *debug_dir;
#endif
/** /**
* @min_tq: only consider neighbors for encoding if neigh_tq > min_tq * @min_tq: only consider neighbors for encoding if neigh_tq > min_tq
...@@ -1392,7 +1393,7 @@ struct batadv_tp_vars { ...@@ -1392,7 +1393,7 @@ struct batadv_tp_vars {
atomic_t dup_acks; atomic_t dup_acks;
/** @fast_recovery: true if in Fast Recovery mode */ /** @fast_recovery: true if in Fast Recovery mode */
bool fast_recovery; unsigned char fast_recovery:1;
/** @recover: last sent seqno when entering Fast Recovery */ /** @recover: last sent seqno when entering Fast Recovery */
u32 recover; u32 recover;
...@@ -1601,8 +1602,10 @@ struct batadv_priv { ...@@ -1601,8 +1602,10 @@ struct batadv_priv {
/** @mesh_obj: kobject for sysfs mesh subdirectory */ /** @mesh_obj: kobject for sysfs mesh subdirectory */
struct kobject *mesh_obj; struct kobject *mesh_obj;
#ifdef CONFIG_BATMAN_ADV_DEBUGFS
/** @debug_dir: dentry for debugfs batman-adv subdirectory */ /** @debug_dir: dentry for debugfs batman-adv subdirectory */
struct dentry *debug_dir; struct dentry *debug_dir;
#endif
/** @forw_bat_list: list of aggregated OGMs that will be forwarded */ /** @forw_bat_list: list of aggregated OGMs that will be forwarded */
struct hlist_head forw_bat_list; struct hlist_head forw_bat_list;
...@@ -2049,10 +2052,10 @@ struct batadv_skb_cb { ...@@ -2049,10 +2052,10 @@ struct batadv_skb_cb {
* @decoded: Marks a skb as decoded, which is checked when searching for * @decoded: Marks a skb as decoded, which is checked when searching for
* coding opportunities in network-coding.c * coding opportunities in network-coding.c
*/ */
bool decoded; unsigned char decoded:1;
/** @num_bcasts: Counter for broadcast packet retransmissions */ /** @num_bcasts: Counter for broadcast packet retransmissions */
unsigned int num_bcasts; unsigned char num_bcasts;
}; };
/** /**
......
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