Skip to content

Commit 5c35242

Browse files
committed
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: David S. Miller <[email protected]>
2 parents 1340546 + 18cfb44 commit 5c35242

File tree

6 files changed

+39
-41
lines changed

6 files changed

+39
-41
lines changed

net/batman-adv/Kconfig

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ config BATMAN_ADV
3535
config BATMAN_ADV_BATMAN_V
3636
bool "B.A.T.M.A.N. V protocol (experimental)"
3737
depends on BATMAN_ADV && !(CFG80211=m && BATMAN_ADV=y)
38-
default n
38+
default y
3939
help
4040
This option enables the B.A.T.M.A.N. V protocol, the successor
4141
of the currently used B.A.T.M.A.N. IV protocol. The main
@@ -94,13 +94,13 @@ config BATMAN_ADV_DEBUGFS
9494
bool "batman-adv debugfs entries"
9595
depends on BATMAN_ADV
9696
depends on DEBUG_FS
97-
default y
97+
default n
9898
help
9999
Enable this to export routing related debug tables via debugfs.
100100
The information for each soft-interface and used hard-interface can be
101101
found under batman_adv/
102102

103-
If unsure, say Y.
103+
If unsure, say N.
104104

105105
config BATMAN_ADV_DEBUG
106106
bool "B.A.T.M.A.N. debugging"

net/batman-adv/bat_v_elp.c

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,20 @@ static u32 batadv_v_elp_get_throughput(struct batadv_hardif_neigh_node *neigh)
127127
rtnl_lock();
128128
ret = __ethtool_get_link_ksettings(hard_iface->net_dev, &link_settings);
129129
rtnl_unlock();
130-
if (ret == 0) {
130+
131+
/* Virtual interface drivers such as tun / tap interfaces, VLAN, etc
132+
* tend to initialize the interface throughput with some value for the
133+
* sake of having a throughput number to export via ethtool. This
134+
* exported throughput leaves batman-adv to conclude the interface
135+
* throughput is genuine (reflecting reality), thus no measurements
136+
* are necessary.
137+
*
138+
* Based on the observation that those interface types also tend to set
139+
* the link auto-negotiation to 'off', batman-adv shall check this
140+
* setting to differentiate between genuine link throughput information
141+
* and placeholders installed by virtual interfaces.
142+
*/
143+
if (ret == 0 && link_settings.base.autoneg == AUTONEG_ENABLE) {
131144
/* link characteristics might change over time */
132145
if (link_settings.base.duplex == DUPLEX_FULL)
133146
hard_iface->bat_v.flags |= BATADV_FULL_DUPLEX;

net/batman-adv/main.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
#define BATADV_DRIVER_DEVICE "batman-adv"
2626

2727
#ifndef BATADV_SOURCE_VERSION
28-
#define BATADV_SOURCE_VERSION "2018.1"
28+
#define BATADV_SOURCE_VERSION "2018.2"
2929
#endif
3030

3131
/* B.A.T.M.A.N. parameters */

net/batman-adv/multicast.c

Lines changed: 6 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -815,9 +815,6 @@ static int batadv_mcast_forw_mode_check(struct batadv_priv *bat_priv,
815815
if (!atomic_read(&bat_priv->multicast_mode))
816816
return -EINVAL;
817817

818-
if (atomic_read(&bat_priv->mcast.num_disabled))
819-
return -EINVAL;
820-
821818
switch (ntohs(ethhdr->h_proto)) {
822819
case ETH_P_IP:
823820
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,
11831180
{
11841181
bool orig_mcast_enabled = !(flags & BATADV_TVLV_HANDLER_OGM_CIFNOTFND);
11851182
u8 mcast_flags = BATADV_NO_FLAGS;
1186-
bool orig_initialized;
11871183

11881184
if (orig_mcast_enabled && tvlv_value &&
11891185
tvlv_value_len >= sizeof(mcast_flags))
11901186
mcast_flags = *(u8 *)tvlv_value;
11911187

1188+
if (!orig_mcast_enabled) {
1189+
mcast_flags |= BATADV_MCAST_WANT_ALL_IPV4;
1190+
mcast_flags |= BATADV_MCAST_WANT_ALL_IPV6;
1191+
}
1192+
11921193
spin_lock_bh(&orig->mcast_handler_lock);
1193-
orig_initialized = test_bit(BATADV_ORIG_CAPA_HAS_MCAST,
1194-
&orig->capa_initialized);
11951194

1196-
/* If mcast support is turned on decrease the disabled mcast node
1197-
* counter only if we had increased it for this node before. If this
1198-
* is a completely new orig_node no need to decrease the counter.
1199-
*/
12001195
if (orig_mcast_enabled &&
12011196
!test_bit(BATADV_ORIG_CAPA_HAS_MCAST, &orig->capabilities)) {
1202-
if (orig_initialized)
1203-
atomic_dec(&bat_priv->mcast.num_disabled);
12041197
set_bit(BATADV_ORIG_CAPA_HAS_MCAST, &orig->capabilities);
1205-
/* If mcast support is being switched off or if this is an initial
1206-
* OGM without mcast support then increase the disabled mcast
1207-
* node counter.
1208-
*/
12091198
} else if (!orig_mcast_enabled &&
1210-
(test_bit(BATADV_ORIG_CAPA_HAS_MCAST, &orig->capabilities) ||
1211-
!orig_initialized)) {
1212-
atomic_inc(&bat_priv->mcast.num_disabled);
1199+
test_bit(BATADV_ORIG_CAPA_HAS_MCAST, &orig->capabilities)) {
12131200
clear_bit(BATADV_ORIG_CAPA_HAS_MCAST, &orig->capabilities);
12141201
}
12151202

@@ -1595,10 +1582,6 @@ void batadv_mcast_purge_orig(struct batadv_orig_node *orig)
15951582

15961583
spin_lock_bh(&orig->mcast_handler_lock);
15971584

1598-
if (!test_bit(BATADV_ORIG_CAPA_HAS_MCAST, &orig->capabilities) &&
1599-
test_bit(BATADV_ORIG_CAPA_HAS_MCAST, &orig->capa_initialized))
1600-
atomic_dec(&bat_priv->mcast.num_disabled);
1601-
16021585
batadv_mcast_want_unsnoop_update(bat_priv, orig, BATADV_NO_FLAGS);
16031586
batadv_mcast_want_ipv4_update(bat_priv, orig, BATADV_NO_FLAGS);
16041587
batadv_mcast_want_ipv6_update(bat_priv, orig, BATADV_NO_FLAGS);

net/batman-adv/soft-interface.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -188,8 +188,8 @@ static void batadv_interface_set_rx_mode(struct net_device *dev)
188188
{
189189
}
190190

191-
static int batadv_interface_tx(struct sk_buff *skb,
192-
struct net_device *soft_iface)
191+
static netdev_tx_t batadv_interface_tx(struct sk_buff *skb,
192+
struct net_device *soft_iface)
193193
{
194194
struct ethhdr *ethhdr;
195195
struct batadv_priv *bat_priv = netdev_priv(soft_iface);
@@ -796,7 +796,6 @@ static int batadv_softif_init_late(struct net_device *dev)
796796
bat_priv->mcast.querier_ipv6.shadowing = false;
797797
bat_priv->mcast.flags = BATADV_NO_FLAGS;
798798
atomic_set(&bat_priv->multicast_mode, 1);
799-
atomic_set(&bat_priv->mcast.num_disabled, 0);
800799
atomic_set(&bat_priv->mcast.num_want_all_unsnoopables, 0);
801800
atomic_set(&bat_priv->mcast.num_want_all_ipv4, 0);
802801
atomic_set(&bat_priv->mcast.num_want_all_ipv6, 0);

net/batman-adv/types.h

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -215,10 +215,12 @@ struct batadv_hard_iface {
215215
struct batadv_hard_iface_bat_v bat_v;
216216
#endif
217217

218+
#ifdef CONFIG_BATMAN_ADV_DEBUGFS
218219
/**
219220
* @debug_dir: dentry for nc subdir in batman-adv directory in debugfs
220221
*/
221222
struct dentry *debug_dir;
223+
#endif
222224

223225
/**
224226
* @neigh_list: list of unique single hop neighbors via this interface
@@ -1160,13 +1162,13 @@ struct batadv_priv_dat {
11601162
*/
11611163
struct batadv_mcast_querier_state {
11621164
/** @exists: whether a querier exists in the mesh */
1163-
bool exists;
1165+
unsigned char exists:1;
11641166

11651167
/**
11661168
* @shadowing: if a querier exists, whether it is potentially shadowing
11671169
* multicast listeners (i.e. querier is behind our own bridge segment)
11681170
*/
1169-
bool shadowing;
1171+
unsigned char shadowing:1;
11701172
};
11711173

11721174
/**
@@ -1207,13 +1209,10 @@ struct batadv_priv_mcast {
12071209
u8 flags;
12081210

12091211
/** @enabled: whether the multicast tvlv is currently enabled */
1210-
bool enabled;
1212+
unsigned char enabled:1;
12111213

12121214
/** @bridged: whether the soft interface has a bridge on top */
1213-
bool bridged;
1214-
1215-
/** @num_disabled: number of nodes that have no mcast tvlv */
1216-
atomic_t num_disabled;
1215+
unsigned char bridged:1;
12171216

12181217
/**
12191218
* @num_want_all_unsnoopables: number of nodes wanting unsnoopable IP
@@ -1245,10 +1244,12 @@ struct batadv_priv_nc {
12451244
/** @work: work queue callback item for cleanup */
12461245
struct delayed_work work;
12471246

1247+
#ifdef CONFIG_BATMAN_ADV_DEBUGFS
12481248
/**
12491249
* @debug_dir: dentry for nc subdir in batman-adv directory in debugfs
12501250
*/
12511251
struct dentry *debug_dir;
1252+
#endif
12521253

12531254
/**
12541255
* @min_tq: only consider neighbors for encoding if neigh_tq > min_tq
@@ -1392,7 +1393,7 @@ struct batadv_tp_vars {
13921393
atomic_t dup_acks;
13931394

13941395
/** @fast_recovery: true if in Fast Recovery mode */
1395-
bool fast_recovery;
1396+
unsigned char fast_recovery:1;
13961397

13971398
/** @recover: last sent seqno when entering Fast Recovery */
13981399
u32 recover;
@@ -1601,8 +1602,10 @@ struct batadv_priv {
16011602
/** @mesh_obj: kobject for sysfs mesh subdirectory */
16021603
struct kobject *mesh_obj;
16031604

1605+
#ifdef CONFIG_BATMAN_ADV_DEBUGFS
16041606
/** @debug_dir: dentry for debugfs batman-adv subdirectory */
16051607
struct dentry *debug_dir;
1608+
#endif
16061609

16071610
/** @forw_bat_list: list of aggregated OGMs that will be forwarded */
16081611
struct hlist_head forw_bat_list;
@@ -2049,10 +2052,10 @@ struct batadv_skb_cb {
20492052
* @decoded: Marks a skb as decoded, which is checked when searching for
20502053
* coding opportunities in network-coding.c
20512054
*/
2052-
bool decoded;
2055+
unsigned char decoded:1;
20532056

20542057
/** @num_bcasts: Counter for broadcast packet retransmissions */
2055-
unsigned int num_bcasts;
2058+
unsigned char num_bcasts;
20562059
};
20572060

20582061
/**

0 commit comments

Comments
 (0)