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

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

Simon Wunderlich says:

====================
This code cleanup patchset includes the following changes (chronological
order):

 - bump version strings, by Simon Wunderlich

 - README updates/clean up, by Sven Eckelmann (4 patches)

 - Code clean up and restructuring by Sven Eckelmann (2 patches)

 - Kerneldoc fix in forw_packet structure, by Linus Luessing

 - Remove unused argument in dbg_arp, by Antonio Quartulli

 - Add support to build batman-adv without wireless, by Linus Luessing

 - Restructure error handling for is_ap_isolated, by Markus Elfring

 - Remove unused initialization in various functions, by Sven Eckelmann

 - Use better names for fragment and gateway list heads, by Sven
   Eckelmann (2 patches)

 - Convert to octal permissions for files, by Sven Eckelmann

 - Avoid precedence issues for some macros, by Sven Eckelmann
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 6ce40fc5 4c7da0f6
...@@ -32,7 +32,7 @@ compatible interfaces. Once found, it will create subfolders in ...@@ -32,7 +32,7 @@ compatible interfaces. Once found, it will create subfolders in
the /sys directories of each supported interface, e.g. the /sys directories of each supported interface, e.g.
# ls /sys/class/net/eth0/batman_adv/ # ls /sys/class/net/eth0/batman_adv/
# iface_status mesh_iface # elp_interval iface_status mesh_iface throughput_override
If an interface does not have the "batman_adv" subfolder it prob- If an interface does not have the "batman_adv" subfolder it prob-
ably is not supported. Not supported interfaces are: loopback, ably is not supported. Not supported interfaces are: loopback,
...@@ -71,17 +71,19 @@ All mesh wide settings can be found in batman's own interface ...@@ -71,17 +71,19 @@ All mesh wide settings can be found in batman's own interface
folder: folder:
# ls /sys/class/net/bat0/mesh/ # ls /sys/class/net/bat0/mesh/
#aggregated_ogms distributed_arp_table gw_sel_class orig_interval # aggregated_ogms fragmentation isolation_mark routing_algo
#ap_isolation fragmentation hop_penalty routing_algo # ap_isolation gw_bandwidth log_level vlan0
#bonding gw_bandwidth isolation_mark vlan0 # bonding gw_mode multicast_mode
#bridge_loop_avoidance gw_mode log_level # bridge_loop_avoidance gw_sel_class network_coding
# distributed_arp_table hop_penalty orig_interval
There is a special folder for debugging information: There is a special folder for debugging information:
# ls /sys/kernel/debug/batman_adv/bat0/ # ls /sys/kernel/debug/batman_adv/bat0/
# bla_backbone_table log transtable_global # bla_backbone_table log neighbors transtable_local
# bla_claim_table originators transtable_local # bla_claim_table mcast_flags originators
# gateways socket # dat_cache nc socket
# gateways nc_nodes transtable_global
Some of the files contain all sort of status information regard- Some of the files contain all sort of status information regard-
ing the mesh network. For example, you can view the table of ing the mesh network. For example, you can view the table of
...@@ -159,13 +161,16 @@ file in debugfs ...@@ -159,13 +161,16 @@ file in debugfs
The additional debug output is by default disabled. It can be en- The additional debug output is by default disabled. It can be en-
abled during run time. Following log_levels are defined: abled during run time. Following log_levels are defined:
0 - All debug output disabled 0 - All debug output disabled
1 - Enable messages related to routing / flooding / broadcasting 1 - Enable messages related to routing / flooding / broadcasting
2 - Enable messages related to route added / changed / deleted 2 - Enable messages related to route added / changed / deleted
4 - Enable messages related to translation table operations 4 - Enable messages related to translation table operations
8 - Enable messages related to bridge loop avoidance 8 - Enable messages related to bridge loop avoidance
16 - Enable messaged related to DAT, ARP snooping and parsing 16 - Enable messages related to DAT, ARP snooping and parsing
31 - Enable all messages 32 - Enable messages related to network coding
64 - Enable messages related to multicast
128 - Enable messages related to throughput meter
255 - Enable all messages
The debug output can be changed at runtime using the file The debug output can be changed at runtime using the file
/sys/class/net/bat0/mesh/log_level. e.g. /sys/class/net/bat0/mesh/log_level. e.g.
......
...@@ -17,7 +17,7 @@ config BATMAN_ADV ...@@ -17,7 +17,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=y || (CFG80211=m && BATMAN_ADV=m) depends on BATMAN_ADV && !(CFG80211=m && BATMAN_ADV=y)
default n default n
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
......
...@@ -2486,7 +2486,7 @@ batadv_iv_gw_get_best_gw_node(struct batadv_priv *bat_priv) ...@@ -2486,7 +2486,7 @@ batadv_iv_gw_get_best_gw_node(struct batadv_priv *bat_priv)
struct batadv_orig_node *orig_node; struct batadv_orig_node *orig_node;
rcu_read_lock(); rcu_read_lock();
hlist_for_each_entry_rcu(gw_node, &bat_priv->gw.list, list) { hlist_for_each_entry_rcu(gw_node, &bat_priv->gw.gateway_list, list) {
orig_node = gw_node->orig_node; orig_node = gw_node->orig_node;
router = batadv_orig_router_get(orig_node, BATADV_IF_DEFAULT); router = batadv_orig_router_get(orig_node, BATADV_IF_DEFAULT);
if (!router) if (!router)
...@@ -2674,7 +2674,7 @@ static void batadv_iv_gw_print(struct batadv_priv *bat_priv, ...@@ -2674,7 +2674,7 @@ static void batadv_iv_gw_print(struct batadv_priv *bat_priv,
" Gateway (#/255) Nexthop [outgoingIF]: advertised uplink bandwidth\n"); " Gateway (#/255) Nexthop [outgoingIF]: advertised uplink bandwidth\n");
rcu_read_lock(); rcu_read_lock();
hlist_for_each_entry_rcu(gw_node, &bat_priv->gw.list, list) { hlist_for_each_entry_rcu(gw_node, &bat_priv->gw.gateway_list, list) {
/* fails if orig_node has no router */ /* fails if orig_node has no router */
if (batadv_iv_gw_write_buffer_text(bat_priv, seq, gw_node) < 0) if (batadv_iv_gw_write_buffer_text(bat_priv, seq, gw_node) < 0)
continue; continue;
...@@ -2774,7 +2774,7 @@ static void batadv_iv_gw_dump(struct sk_buff *msg, struct netlink_callback *cb, ...@@ -2774,7 +2774,7 @@ static void batadv_iv_gw_dump(struct sk_buff *msg, struct netlink_callback *cb,
int idx = 0; int idx = 0;
rcu_read_lock(); rcu_read_lock();
hlist_for_each_entry_rcu(gw_node, &bat_priv->gw.list, list) { hlist_for_each_entry_rcu(gw_node, &bat_priv->gw.gateway_list, list) {
if (idx++ < idx_skip) if (idx++ < idx_skip)
continue; continue;
......
...@@ -750,7 +750,7 @@ batadv_v_gw_get_best_gw_node(struct batadv_priv *bat_priv) ...@@ -750,7 +750,7 @@ batadv_v_gw_get_best_gw_node(struct batadv_priv *bat_priv)
u32 max_bw = 0, bw; u32 max_bw = 0, bw;
rcu_read_lock(); rcu_read_lock();
hlist_for_each_entry_rcu(gw_node, &bat_priv->gw.list, list) { hlist_for_each_entry_rcu(gw_node, &bat_priv->gw.gateway_list, list) {
if (!kref_get_unless_zero(&gw_node->refcount)) if (!kref_get_unless_zero(&gw_node->refcount))
continue; continue;
...@@ -787,7 +787,7 @@ static bool batadv_v_gw_is_eligible(struct batadv_priv *bat_priv, ...@@ -787,7 +787,7 @@ static bool batadv_v_gw_is_eligible(struct batadv_priv *bat_priv,
struct batadv_orig_node *curr_gw_orig, struct batadv_orig_node *curr_gw_orig,
struct batadv_orig_node *orig_node) struct batadv_orig_node *orig_node)
{ {
struct batadv_gw_node *curr_gw = NULL, *orig_gw = NULL; struct batadv_gw_node *curr_gw, *orig_gw = NULL;
u32 gw_throughput, orig_throughput, threshold; u32 gw_throughput, orig_throughput, threshold;
bool ret = false; bool ret = false;
...@@ -889,7 +889,7 @@ static void batadv_v_gw_print(struct batadv_priv *bat_priv, ...@@ -889,7 +889,7 @@ static void batadv_v_gw_print(struct batadv_priv *bat_priv,
" Gateway ( throughput) Nexthop [outgoingIF]: advertised uplink bandwidth\n"); " Gateway ( throughput) Nexthop [outgoingIF]: advertised uplink bandwidth\n");
rcu_read_lock(); rcu_read_lock();
hlist_for_each_entry_rcu(gw_node, &bat_priv->gw.list, list) { hlist_for_each_entry_rcu(gw_node, &bat_priv->gw.gateway_list, list) {
/* fails if orig_node has no router */ /* fails if orig_node has no router */
if (batadv_v_gw_write_buffer_text(bat_priv, seq, gw_node) < 0) if (batadv_v_gw_write_buffer_text(bat_priv, seq, gw_node) < 0)
continue; continue;
...@@ -1009,7 +1009,7 @@ static void batadv_v_gw_dump(struct sk_buff *msg, struct netlink_callback *cb, ...@@ -1009,7 +1009,7 @@ static void batadv_v_gw_dump(struct sk_buff *msg, struct netlink_callback *cb,
int idx = 0; int idx = 0;
rcu_read_lock(); rcu_read_lock();
hlist_for_each_entry_rcu(gw_node, &bat_priv->gw.list, list) { hlist_for_each_entry_rcu(gw_node, &bat_priv->gw.gateway_list, list) {
if (idx++ < idx_skip) if (idx++ < idx_skip)
continue; continue;
......
...@@ -401,7 +401,7 @@ static int batadv_v_ogm_metric_update(struct batadv_priv *bat_priv, ...@@ -401,7 +401,7 @@ static int batadv_v_ogm_metric_update(struct batadv_priv *bat_priv,
struct batadv_hard_iface *if_incoming, struct batadv_hard_iface *if_incoming,
struct batadv_hard_iface *if_outgoing) struct batadv_hard_iface *if_outgoing)
{ {
struct batadv_orig_ifinfo *orig_ifinfo = NULL; struct batadv_orig_ifinfo *orig_ifinfo;
struct batadv_neigh_ifinfo *neigh_ifinfo = NULL; struct batadv_neigh_ifinfo *neigh_ifinfo = NULL;
bool protection_started = false; bool protection_started = false;
int ret = -EINVAL; int ret = -EINVAL;
...@@ -486,7 +486,7 @@ static bool batadv_v_ogm_route_update(struct batadv_priv *bat_priv, ...@@ -486,7 +486,7 @@ static bool batadv_v_ogm_route_update(struct batadv_priv *bat_priv,
struct batadv_hard_iface *if_outgoing) struct batadv_hard_iface *if_outgoing)
{ {
struct batadv_neigh_node *router = NULL; struct batadv_neigh_node *router = NULL;
struct batadv_orig_node *orig_neigh_node = NULL; struct batadv_orig_node *orig_neigh_node;
struct batadv_neigh_node *orig_neigh_router = NULL; struct batadv_neigh_node *orig_neigh_router = NULL;
struct batadv_neigh_ifinfo *router_ifinfo = NULL, *neigh_ifinfo = NULL; struct batadv_neigh_ifinfo *router_ifinfo = NULL, *neigh_ifinfo = NULL;
u32 router_throughput, neigh_throughput; u32 router_throughput, neigh_throughput;
......
...@@ -186,7 +186,7 @@ struct batadv_debuginfo batadv_debuginfo_##_name = { \ ...@@ -186,7 +186,7 @@ struct batadv_debuginfo batadv_debuginfo_##_name = { \
/* the following attributes are general and therefore they will be directly /* the following attributes are general and therefore they will be directly
* placed in the BATADV_DEBUGFS_SUBDIR subdirectory of debugfs * placed in the BATADV_DEBUGFS_SUBDIR subdirectory of debugfs
*/ */
static BATADV_DEBUGINFO(routing_algos, S_IRUGO, batadv_algorithms_open); static BATADV_DEBUGINFO(routing_algos, 0444, batadv_algorithms_open);
static struct batadv_debuginfo *batadv_general_debuginfos[] = { static struct batadv_debuginfo *batadv_general_debuginfos[] = {
&batadv_debuginfo_routing_algos, &batadv_debuginfo_routing_algos,
...@@ -194,26 +194,24 @@ static struct batadv_debuginfo *batadv_general_debuginfos[] = { ...@@ -194,26 +194,24 @@ static struct batadv_debuginfo *batadv_general_debuginfos[] = {
}; };
/* The following attributes are per soft interface */ /* The following attributes are per soft interface */
static BATADV_DEBUGINFO(neighbors, S_IRUGO, neighbors_open); static BATADV_DEBUGINFO(neighbors, 0444, neighbors_open);
static BATADV_DEBUGINFO(originators, S_IRUGO, batadv_originators_open); static BATADV_DEBUGINFO(originators, 0444, batadv_originators_open);
static BATADV_DEBUGINFO(gateways, S_IRUGO, batadv_gateways_open); static BATADV_DEBUGINFO(gateways, 0444, batadv_gateways_open);
static BATADV_DEBUGINFO(transtable_global, S_IRUGO, static BATADV_DEBUGINFO(transtable_global, 0444, batadv_transtable_global_open);
batadv_transtable_global_open);
#ifdef CONFIG_BATMAN_ADV_BLA #ifdef CONFIG_BATMAN_ADV_BLA
static BATADV_DEBUGINFO(bla_claim_table, S_IRUGO, batadv_bla_claim_table_open); static BATADV_DEBUGINFO(bla_claim_table, 0444, batadv_bla_claim_table_open);
static BATADV_DEBUGINFO(bla_backbone_table, S_IRUGO, static BATADV_DEBUGINFO(bla_backbone_table, 0444,
batadv_bla_backbone_table_open); batadv_bla_backbone_table_open);
#endif #endif
#ifdef CONFIG_BATMAN_ADV_DAT #ifdef CONFIG_BATMAN_ADV_DAT
static BATADV_DEBUGINFO(dat_cache, S_IRUGO, batadv_dat_cache_open); static BATADV_DEBUGINFO(dat_cache, 0444, batadv_dat_cache_open);
#endif #endif
static BATADV_DEBUGINFO(transtable_local, S_IRUGO, static BATADV_DEBUGINFO(transtable_local, 0444, batadv_transtable_local_open);
batadv_transtable_local_open);
#ifdef CONFIG_BATMAN_ADV_NC #ifdef CONFIG_BATMAN_ADV_NC
static BATADV_DEBUGINFO(nc_nodes, S_IRUGO, batadv_nc_nodes_open); static BATADV_DEBUGINFO(nc_nodes, 0444, batadv_nc_nodes_open);
#endif #endif
#ifdef CONFIG_BATMAN_ADV_MCAST #ifdef CONFIG_BATMAN_ADV_MCAST
static BATADV_DEBUGINFO(mcast_flags, S_IRUGO, batadv_mcast_flags_open); static BATADV_DEBUGINFO(mcast_flags, 0444, batadv_mcast_flags_open);
#endif #endif
static struct batadv_debuginfo *batadv_mesh_debuginfos[] = { static struct batadv_debuginfo *batadv_mesh_debuginfos[] = {
...@@ -253,7 +251,7 @@ struct batadv_debuginfo batadv_hardif_debuginfo_##_name = { \ ...@@ -253,7 +251,7 @@ struct batadv_debuginfo batadv_hardif_debuginfo_##_name = { \
}, \ }, \
} }
static BATADV_HARDIF_DEBUGINFO(originators, S_IRUGO, static BATADV_HARDIF_DEBUGINFO(originators, 0444,
batadv_originators_hardif_open); batadv_originators_hardif_open);
static struct batadv_debuginfo *batadv_hardif_debuginfos[] = { static struct batadv_debuginfo *batadv_hardif_debuginfos[] = {
......
...@@ -369,12 +369,11 @@ static void batadv_dat_entry_add(struct batadv_priv *bat_priv, __be32 ip, ...@@ -369,12 +369,11 @@ static void batadv_dat_entry_add(struct batadv_priv *bat_priv, __be32 ip,
* batadv_dbg_arp - print a debug message containing all the ARP packet details * batadv_dbg_arp - print a debug message containing all the ARP packet details
* @bat_priv: the bat priv with all the soft interface information * @bat_priv: the bat priv with all the soft interface information
* @skb: ARP packet * @skb: ARP packet
* @type: ARP type
* @hdr_size: size of the possible header before the ARP packet * @hdr_size: size of the possible header before the ARP packet
* @msg: message to print together with the debugging information * @msg: message to print together with the debugging information
*/ */
static void batadv_dbg_arp(struct batadv_priv *bat_priv, struct sk_buff *skb, static void batadv_dbg_arp(struct batadv_priv *bat_priv, struct sk_buff *skb,
u16 type, int hdr_size, char *msg) int hdr_size, char *msg)
{ {
struct batadv_unicast_4addr_packet *unicast_4addr_packet; struct batadv_unicast_4addr_packet *unicast_4addr_packet;
struct batadv_bcast_packet *bcast_pkt; struct batadv_bcast_packet *bcast_pkt;
...@@ -441,7 +440,7 @@ static void batadv_dbg_arp(struct batadv_priv *bat_priv, struct sk_buff *skb, ...@@ -441,7 +440,7 @@ static void batadv_dbg_arp(struct batadv_priv *bat_priv, struct sk_buff *skb,
#else #else
static void batadv_dbg_arp(struct batadv_priv *bat_priv, struct sk_buff *skb, static void batadv_dbg_arp(struct batadv_priv *bat_priv, struct sk_buff *skb,
u16 type, int hdr_size, char *msg) int hdr_size, char *msg)
{ {
} }
...@@ -983,8 +982,7 @@ bool batadv_dat_snoop_outgoing_arp_request(struct batadv_priv *bat_priv, ...@@ -983,8 +982,7 @@ bool batadv_dat_snoop_outgoing_arp_request(struct batadv_priv *bat_priv,
if (type != ARPOP_REQUEST) if (type != ARPOP_REQUEST)
goto out; goto out;
batadv_dbg_arp(bat_priv, skb, type, hdr_size, batadv_dbg_arp(bat_priv, skb, hdr_size, "Parsing outgoing ARP REQUEST");
"Parsing outgoing ARP REQUEST");
ip_src = batadv_arp_ip_src(skb, hdr_size); ip_src = batadv_arp_ip_src(skb, hdr_size);
hw_src = batadv_arp_hw_src(skb, hdr_size); hw_src = batadv_arp_hw_src(skb, hdr_size);
...@@ -1075,8 +1073,7 @@ bool batadv_dat_snoop_incoming_arp_request(struct batadv_priv *bat_priv, ...@@ -1075,8 +1073,7 @@ bool batadv_dat_snoop_incoming_arp_request(struct batadv_priv *bat_priv,
ip_src = batadv_arp_ip_src(skb, hdr_size); ip_src = batadv_arp_ip_src(skb, hdr_size);
ip_dst = batadv_arp_ip_dst(skb, hdr_size); ip_dst = batadv_arp_ip_dst(skb, hdr_size);
batadv_dbg_arp(bat_priv, skb, type, hdr_size, batadv_dbg_arp(bat_priv, skb, hdr_size, "Parsing incoming ARP REQUEST");
"Parsing incoming ARP REQUEST");
batadv_dat_entry_add(bat_priv, ip_src, hw_src, vid); batadv_dat_entry_add(bat_priv, ip_src, hw_src, vid);
...@@ -1149,8 +1146,7 @@ void batadv_dat_snoop_outgoing_arp_reply(struct batadv_priv *bat_priv, ...@@ -1149,8 +1146,7 @@ void batadv_dat_snoop_outgoing_arp_reply(struct batadv_priv *bat_priv,
if (type != ARPOP_REPLY) if (type != ARPOP_REPLY)
return; return;
batadv_dbg_arp(bat_priv, skb, type, hdr_size, batadv_dbg_arp(bat_priv, skb, hdr_size, "Parsing outgoing ARP REPLY");
"Parsing outgoing ARP REPLY");
hw_src = batadv_arp_hw_src(skb, hdr_size); hw_src = batadv_arp_hw_src(skb, hdr_size);
ip_src = batadv_arp_ip_src(skb, hdr_size); ip_src = batadv_arp_ip_src(skb, hdr_size);
...@@ -1195,8 +1191,7 @@ bool batadv_dat_snoop_incoming_arp_reply(struct batadv_priv *bat_priv, ...@@ -1195,8 +1191,7 @@ bool batadv_dat_snoop_incoming_arp_reply(struct batadv_priv *bat_priv,
if (type != ARPOP_REPLY) if (type != ARPOP_REPLY)
goto out; goto out;
batadv_dbg_arp(bat_priv, skb, type, hdr_size, batadv_dbg_arp(bat_priv, skb, hdr_size, "Parsing incoming ARP REPLY");
"Parsing incoming ARP REPLY");
hw_src = batadv_arp_hw_src(skb, hdr_size); hw_src = batadv_arp_hw_src(skb, hdr_size);
ip_src = batadv_arp_ip_src(skb, hdr_size); ip_src = batadv_arp_ip_src(skb, hdr_size);
......
...@@ -73,7 +73,7 @@ void batadv_frag_purge_orig(struct batadv_orig_node *orig_node, ...@@ -73,7 +73,7 @@ void batadv_frag_purge_orig(struct batadv_orig_node *orig_node,
spin_lock_bh(&chain->lock); spin_lock_bh(&chain->lock);
if (!check_cb || check_cb(chain)) { if (!check_cb || check_cb(chain)) {
batadv_frag_clear_chain(&chain->head); batadv_frag_clear_chain(&chain->fragment_list);
chain->size = 0; chain->size = 0;
} }
...@@ -117,8 +117,8 @@ static bool batadv_frag_init_chain(struct batadv_frag_table_entry *chain, ...@@ -117,8 +117,8 @@ static bool batadv_frag_init_chain(struct batadv_frag_table_entry *chain,
if (chain->seqno == seqno) if (chain->seqno == seqno)
return false; return false;
if (!hlist_empty(&chain->head)) if (!hlist_empty(&chain->fragment_list))
batadv_frag_clear_chain(&chain->head); batadv_frag_clear_chain(&chain->fragment_list);
chain->size = 0; chain->size = 0;
chain->seqno = seqno; chain->seqno = seqno;
...@@ -176,7 +176,7 @@ static bool batadv_frag_insert_packet(struct batadv_orig_node *orig_node, ...@@ -176,7 +176,7 @@ static bool batadv_frag_insert_packet(struct batadv_orig_node *orig_node,
chain = &orig_node->fragments[bucket]; chain = &orig_node->fragments[bucket];
spin_lock_bh(&chain->lock); spin_lock_bh(&chain->lock);
if (batadv_frag_init_chain(chain, seqno)) { if (batadv_frag_init_chain(chain, seqno)) {
hlist_add_head(&frag_entry_new->list, &chain->head); hlist_add_head(&frag_entry_new->list, &chain->fragment_list);
chain->size = skb->len - hdr_size; chain->size = skb->len - hdr_size;
chain->timestamp = jiffies; chain->timestamp = jiffies;
chain->total_size = ntohs(frag_packet->total_size); chain->total_size = ntohs(frag_packet->total_size);
...@@ -185,7 +185,7 @@ static bool batadv_frag_insert_packet(struct batadv_orig_node *orig_node, ...@@ -185,7 +185,7 @@ static bool batadv_frag_insert_packet(struct batadv_orig_node *orig_node,
} }
/* Find the position for the new fragment. */ /* Find the position for the new fragment. */
hlist_for_each_entry(frag_entry_curr, &chain->head, list) { hlist_for_each_entry(frag_entry_curr, &chain->fragment_list, list) {
/* Drop packet if fragment already exists. */ /* Drop packet if fragment already exists. */
if (frag_entry_curr->no == frag_entry_new->no) if (frag_entry_curr->no == frag_entry_new->no)
goto err_unlock; goto err_unlock;
...@@ -220,11 +220,11 @@ static bool batadv_frag_insert_packet(struct batadv_orig_node *orig_node, ...@@ -220,11 +220,11 @@ static bool batadv_frag_insert_packet(struct batadv_orig_node *orig_node,
* exceeds the maximum size of one merged packet. Don't allow * exceeds the maximum size of one merged packet. Don't allow
* packets to have different total_size. * packets to have different total_size.
*/ */
batadv_frag_clear_chain(&chain->head); batadv_frag_clear_chain(&chain->fragment_list);
chain->size = 0; chain->size = 0;
} else if (ntohs(frag_packet->total_size) == chain->size) { } else if (ntohs(frag_packet->total_size) == chain->size) {
/* All fragments received. Hand over chain to caller. */ /* All fragments received. Hand over chain to caller. */
hlist_move_list(&chain->head, chain_out); hlist_move_list(&chain->fragment_list, chain_out);
chain->size = 0; chain->size = 0;
} }
...@@ -252,7 +252,7 @@ batadv_frag_merge_packets(struct hlist_head *chain) ...@@ -252,7 +252,7 @@ batadv_frag_merge_packets(struct hlist_head *chain)
{ {
struct batadv_frag_packet *packet; struct batadv_frag_packet *packet;
struct batadv_frag_list_entry *entry; struct batadv_frag_list_entry *entry;
struct sk_buff *skb_out = NULL; struct sk_buff *skb_out;
int size, hdr_size = sizeof(struct batadv_frag_packet); int size, hdr_size = sizeof(struct batadv_frag_packet);
/* Remove first entry, as this is the destination for the rest of the /* Remove first entry, as this is the destination for the rest of the
...@@ -352,7 +352,7 @@ bool batadv_frag_skb_fwd(struct sk_buff *skb, ...@@ -352,7 +352,7 @@ bool batadv_frag_skb_fwd(struct sk_buff *skb,
struct batadv_orig_node *orig_node_src) struct batadv_orig_node *orig_node_src)
{ {
struct batadv_priv *bat_priv = netdev_priv(recv_if->soft_iface); struct batadv_priv *bat_priv = netdev_priv(recv_if->soft_iface);
struct batadv_orig_node *orig_node_dst = NULL; struct batadv_orig_node *orig_node_dst;
struct batadv_neigh_node *neigh_node = NULL; struct batadv_neigh_node *neigh_node = NULL;
struct batadv_frag_packet *packet; struct batadv_frag_packet *packet;
u16 total_size; u16 total_size;
......
...@@ -47,7 +47,7 @@ int batadv_frag_send_packet(struct sk_buff *skb, ...@@ -47,7 +47,7 @@ int batadv_frag_send_packet(struct sk_buff *skb,
static inline bool static inline bool
batadv_frag_check_entry(struct batadv_frag_table_entry *frags_entry) batadv_frag_check_entry(struct batadv_frag_table_entry *frags_entry)
{ {
if (!hlist_empty(&frags_entry->head) && if (!hlist_empty(&frags_entry->fragment_list) &&
batadv_has_timed_out(frags_entry->timestamp, BATADV_FRAG_TIMEOUT)) batadv_has_timed_out(frags_entry->timestamp, BATADV_FRAG_TIMEOUT))
return true; return true;
return false; return false;
......
...@@ -348,7 +348,7 @@ static void batadv_gw_node_add(struct batadv_priv *bat_priv, ...@@ -348,7 +348,7 @@ static void batadv_gw_node_add(struct batadv_priv *bat_priv,
spin_lock_bh(&bat_priv->gw.list_lock); spin_lock_bh(&bat_priv->gw.list_lock);
kref_get(&gw_node->refcount); kref_get(&gw_node->refcount);
hlist_add_head_rcu(&gw_node->list, &bat_priv->gw.list); hlist_add_head_rcu(&gw_node->list, &bat_priv->gw.gateway_list);
spin_unlock_bh(&bat_priv->gw.list_lock); spin_unlock_bh(&bat_priv->gw.list_lock);
batadv_dbg(BATADV_DBG_BATMAN, bat_priv, batadv_dbg(BATADV_DBG_BATMAN, bat_priv,
...@@ -376,7 +376,8 @@ struct batadv_gw_node *batadv_gw_node_get(struct batadv_priv *bat_priv, ...@@ -376,7 +376,8 @@ struct batadv_gw_node *batadv_gw_node_get(struct batadv_priv *bat_priv,
struct batadv_gw_node *gw_node_tmp, *gw_node = NULL; struct batadv_gw_node *gw_node_tmp, *gw_node = NULL;
rcu_read_lock(); rcu_read_lock();
hlist_for_each_entry_rcu(gw_node_tmp, &bat_priv->gw.list, list) { hlist_for_each_entry_rcu(gw_node_tmp, &bat_priv->gw.gateway_list,
list) {
if (gw_node_tmp->orig_node != orig_node) if (gw_node_tmp->orig_node != orig_node)
continue; continue;
...@@ -475,7 +476,7 @@ void batadv_gw_node_free(struct batadv_priv *bat_priv) ...@@ -475,7 +476,7 @@ void batadv_gw_node_free(struct batadv_priv *bat_priv)
spin_lock_bh(&bat_priv->gw.list_lock); spin_lock_bh(&bat_priv->gw.list_lock);
hlist_for_each_entry_safe(gw_node, node_tmp, hlist_for_each_entry_safe(gw_node, node_tmp,
&bat_priv->gw.list, list) { &bat_priv->gw.gateway_list, list) {
hlist_del_init_rcu(&gw_node->list); hlist_del_init_rcu(&gw_node->list);
batadv_gw_node_put(gw_node); batadv_gw_node_put(gw_node);
} }
...@@ -704,7 +705,7 @@ bool batadv_gw_out_of_range(struct batadv_priv *bat_priv, ...@@ -704,7 +705,7 @@ bool batadv_gw_out_of_range(struct batadv_priv *bat_priv,
{ {
struct batadv_neigh_node *neigh_curr = NULL; struct batadv_neigh_node *neigh_curr = NULL;
struct batadv_neigh_node *neigh_old = NULL; struct batadv_neigh_node *neigh_old = NULL;
struct batadv_orig_node *orig_dst_node = NULL; struct batadv_orig_node *orig_dst_node;
struct batadv_gw_node *gw_node = NULL; struct batadv_gw_node *gw_node = NULL;
struct batadv_gw_node *curr_gw = NULL; struct batadv_gw_node *curr_gw = NULL;
struct batadv_neigh_ifinfo *curr_ifinfo, *old_ifinfo; struct batadv_neigh_ifinfo *curr_ifinfo, *old_ifinfo;
......
...@@ -61,36 +61,6 @@ void batadv_hash_set_lock_class(struct batadv_hashtable *hash, ...@@ -61,36 +61,6 @@ void batadv_hash_set_lock_class(struct batadv_hashtable *hash,
/* free only the hashtable and the hash itself. */ /* free only the hashtable and the hash itself. */
void batadv_hash_destroy(struct batadv_hashtable *hash); void batadv_hash_destroy(struct batadv_hashtable *hash);
/* remove the hash structure. if hashdata_free_cb != NULL, this function will be
* called to remove the elements inside of the hash. if you don't remove the
* elements, memory might be leaked.
*/
static inline void batadv_hash_delete(struct batadv_hashtable *hash,
batadv_hashdata_free_cb free_cb,
void *arg)
{
struct hlist_head *head;
struct hlist_node *node, *node_tmp;
spinlock_t *list_lock; /* spinlock to protect write access */
u32 i;
for (i = 0; i < hash->size; i++) {
head = &hash->table[i];
list_lock = &hash->list_locks[i];
spin_lock_bh(list_lock);
hlist_for_each_safe(node, node_tmp, head) {
hlist_del_rcu(node);
if (free_cb)
free_cb(node, arg);
}
spin_unlock_bh(list_lock);
}
batadv_hash_destroy(hash);
}
/** /**
* batadv_hash_add - adds data to the hashtable * batadv_hash_add - adds data to the hashtable
* @hash: storage hash table * @hash: storage hash table
......
...@@ -38,7 +38,6 @@ ...@@ -38,7 +38,6 @@
#include <linux/skbuff.h> #include <linux/skbuff.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/spinlock.h> #include <linux/spinlock.h>
#include <linux/stat.h>
#include <linux/stddef.h> #include <linux/stddef.h>
#include <linux/string.h> #include <linux/string.h>
#include <linux/uaccess.h> #include <linux/uaccess.h>
...@@ -322,8 +321,8 @@ int batadv_socket_setup(struct batadv_priv *bat_priv) ...@@ -322,8 +321,8 @@ int batadv_socket_setup(struct batadv_priv *bat_priv)
if (!bat_priv->debug_dir) if (!bat_priv->debug_dir)
goto err; goto err;
d = debugfs_create_file(BATADV_ICMP_SOCKET, S_IFREG | S_IWUSR | S_IRUSR, d = debugfs_create_file(BATADV_ICMP_SOCKET, 0600, bat_priv->debug_dir,
bat_priv->debug_dir, bat_priv, &batadv_fops); bat_priv, &batadv_fops);
if (!d) if (!d)
goto err; goto err;
......
...@@ -31,7 +31,6 @@ ...@@ -31,7 +31,6 @@
#include <linux/sched.h> /* for linux/wait.h */ #include <linux/sched.h> /* for linux/wait.h */
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/spinlock.h> #include <linux/spinlock.h>
#include <linux/stat.h>
#include <linux/stddef.h> #include <linux/stddef.h>
#include <linux/types.h> #include <linux/types.h>
#include <linux/uaccess.h> #include <linux/uaccess.h>
...@@ -212,8 +211,7 @@ int batadv_debug_log_setup(struct batadv_priv *bat_priv) ...@@ -212,8 +211,7 @@ int batadv_debug_log_setup(struct batadv_priv *bat_priv)
spin_lock_init(&bat_priv->debug_log->lock); spin_lock_init(&bat_priv->debug_log->lock);
init_waitqueue_head(&bat_priv->debug_log->queue_wait); init_waitqueue_head(&bat_priv->debug_log->queue_wait);
d = debugfs_create_file("log", S_IFREG | S_IRUSR, d = debugfs_create_file("log", 0400, bat_priv->debug_dir, bat_priv,
bat_priv->debug_dir, bat_priv,
&batadv_log_fops); &batadv_log_fops);
if (!d) if (!d)
goto err; goto err;
......
...@@ -71,12 +71,12 @@ int batadv_debug_log(struct batadv_priv *bat_priv, const char *fmt, ...) ...@@ -71,12 +71,12 @@ int batadv_debug_log(struct batadv_priv *bat_priv, const char *fmt, ...)
__printf(2, 3); __printf(2, 3);
/* possibly ratelimited debug output */ /* possibly ratelimited debug output */
#define _batadv_dbg(type, bat_priv, ratelimited, fmt, arg...) \ #define _batadv_dbg(type, bat_priv, ratelimited, fmt, arg...) \
do { \ do { \
if (atomic_read(&bat_priv->log_level) & type && \ if (atomic_read(&(bat_priv)->log_level) & (type) && \
(!ratelimited || net_ratelimit())) \ (!(ratelimited) || net_ratelimit())) \
batadv_debug_log(bat_priv, fmt, ## arg);\ batadv_debug_log(bat_priv, fmt, ## arg); \
} \ } \
while (0) while (0)
#else /* !CONFIG_BATMAN_ADV_DEBUG */ #else /* !CONFIG_BATMAN_ADV_DEBUG */
__printf(4, 5) __printf(4, 5)
......
...@@ -160,7 +160,7 @@ int batadv_mesh_init(struct net_device *soft_iface) ...@@ -160,7 +160,7 @@ int batadv_mesh_init(struct net_device *soft_iface)
INIT_HLIST_HEAD(&bat_priv->forw_bat_list); INIT_HLIST_HEAD(&bat_priv->forw_bat_list);
INIT_HLIST_HEAD(&bat_priv->forw_bcast_list); INIT_HLIST_HEAD(&bat_priv->forw_bcast_list);
INIT_HLIST_HEAD(&bat_priv->gw.list); INIT_HLIST_HEAD(&bat_priv->gw.gateway_list);
#ifdef CONFIG_BATMAN_ADV_MCAST #ifdef CONFIG_BATMAN_ADV_MCAST
INIT_HLIST_HEAD(&bat_priv->mcast.want_all_unsnoopables_list); INIT_HLIST_HEAD(&bat_priv->mcast.want_all_unsnoopables_list);
INIT_HLIST_HEAD(&bat_priv->mcast.want_all_ipv4_list); INIT_HLIST_HEAD(&bat_priv->mcast.want_all_ipv4_list);
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,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 "2016.4" #define BATADV_SOURCE_VERSION "2016.5"
#endif #endif
/* B.A.T.M.A.N. parameters */ /* B.A.T.M.A.N. parameters */
...@@ -185,7 +185,6 @@ enum batadv_uev_type { ...@@ -185,7 +185,6 @@ enum batadv_uev_type {
#include <linux/bitops.h> /* for packet.h */ #include <linux/bitops.h> /* for packet.h */
#include <linux/compiler.h> #include <linux/compiler.h>
#include <linux/cpumask.h>
#include <linux/etherdevice.h> #include <linux/etherdevice.h>
#include <linux/if_ether.h> /* for packet.h */ #include <linux/if_ether.h> /* for packet.h */
#include <linux/if_vlan.h> #include <linux/if_vlan.h>
...@@ -200,8 +199,8 @@ struct packet_type; ...@@ -200,8 +199,8 @@ struct packet_type;
struct seq_file; struct seq_file;
struct sk_buff; struct sk_buff;
#define BATADV_PRINT_VID(vid) ((vid & BATADV_VLAN_HAS_TAG) ? \ #define BATADV_PRINT_VID(vid) (((vid) & BATADV_VLAN_HAS_TAG) ? \
(int)(vid & VLAN_VID_MASK) : -1) (int)((vid) & VLAN_VID_MASK) : -1)
extern struct list_head batadv_hardif_list; extern struct list_head batadv_hardif_list;
...@@ -284,26 +283,6 @@ static inline void batadv_add_counter(struct batadv_priv *bat_priv, size_t idx, ...@@ -284,26 +283,6 @@ static inline void batadv_add_counter(struct batadv_priv *bat_priv, size_t idx,
#define batadv_inc_counter(b, i) batadv_add_counter(b, i, 1) #define batadv_inc_counter(b, i) batadv_add_counter(b, i, 1)
/**
* batadv_sum_counter - Sum the cpu-local counters for index 'idx'
* @bat_priv: the bat priv with all the soft interface information
* @idx: index of counter to sum up
*
* Return: sum of all cpu-local counters
*/
static inline u64 batadv_sum_counter(struct batadv_priv *bat_priv, size_t idx)
{
u64 *counters, sum = 0;
int cpu;
for_each_possible_cpu(cpu) {
counters = per_cpu_ptr(bat_priv->bat_counters, cpu);
sum += counters[idx];
}
return sum;
}
/* Define a macro to reach the control buffer of the skb. The members of the /* Define a macro to reach the control buffer of the skb. The members of the
* control buffer are defined in struct batadv_skb_cb in types.h. * control buffer are defined in struct batadv_skb_cb in types.h.
* The macro is inspired by the similar macro TCP_SKB_CB() in tcp.h. * The macro is inspired by the similar macro TCP_SKB_CB() in tcp.h.
......
...@@ -44,7 +44,6 @@ ...@@ -44,7 +44,6 @@
#include <linux/skbuff.h> #include <linux/skbuff.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/spinlock.h> #include <linux/spinlock.h>
#include <linux/stat.h>
#include <linux/stddef.h> #include <linux/stddef.h>
#include <linux/string.h> #include <linux/string.h>
#include <linux/workqueue.h> #include <linux/workqueue.h>
...@@ -1961,17 +1960,16 @@ int batadv_nc_init_debugfs(struct batadv_priv *bat_priv) ...@@ -1961,17 +1960,16 @@ int batadv_nc_init_debugfs(struct batadv_priv *bat_priv)
if (!nc_dir) if (!nc_dir)
goto out; goto out;
file = debugfs_create_u8("min_tq", S_IRUGO | S_IWUSR, nc_dir, file = debugfs_create_u8("min_tq", 0644, nc_dir, &bat_priv->nc.min_tq);
&bat_priv->nc.min_tq);
if (!file) if (!file)
goto out; goto out;
file = debugfs_create_u32("max_fwd_delay", S_IRUGO | S_IWUSR, nc_dir, file = debugfs_create_u32("max_fwd_delay", 0644, nc_dir,
&bat_priv->nc.max_fwd_delay); &bat_priv->nc.max_fwd_delay);
if (!file) if (!file)
goto out; goto out;
file = debugfs_create_u32("max_buffer_time", S_IRUGO | S_IWUSR, nc_dir, file = debugfs_create_u32("max_buffer_time", 0644, nc_dir,
&bat_priv->nc.max_buffer_time); &bat_priv->nc.max_buffer_time);
if (!file) if (!file)
goto out; goto out;
......
...@@ -364,7 +364,7 @@ struct batadv_orig_ifinfo * ...@@ -364,7 +364,7 @@ struct batadv_orig_ifinfo *
batadv_orig_ifinfo_new(struct batadv_orig_node *orig_node, batadv_orig_ifinfo_new(struct batadv_orig_node *orig_node,
struct batadv_hard_iface *if_outgoing) struct batadv_hard_iface *if_outgoing)
{ {
struct batadv_orig_ifinfo *orig_ifinfo = NULL; struct batadv_orig_ifinfo *orig_ifinfo;
unsigned long reset_time; unsigned long reset_time;
spin_lock_bh(&orig_node->neigh_list_lock); spin_lock_bh(&orig_node->neigh_list_lock);
...@@ -520,7 +520,7 @@ batadv_hardif_neigh_create(struct batadv_hard_iface *hard_iface, ...@@ -520,7 +520,7 @@ batadv_hardif_neigh_create(struct batadv_hard_iface *hard_iface,
const u8 *neigh_addr) const u8 *neigh_addr)
{ {
struct batadv_priv *bat_priv = netdev_priv(hard_iface->soft_iface); struct batadv_priv *bat_priv = netdev_priv(hard_iface->soft_iface);
struct batadv_hardif_neigh_node *hardif_neigh = NULL; struct batadv_hardif_neigh_node *hardif_neigh;
spin_lock_bh(&hard_iface->neigh_list_lock); spin_lock_bh(&hard_iface->neigh_list_lock);
...@@ -563,7 +563,7 @@ static struct batadv_hardif_neigh_node * ...@@ -563,7 +563,7 @@ static struct batadv_hardif_neigh_node *
batadv_hardif_neigh_get_or_create(struct batadv_hard_iface *hard_iface, batadv_hardif_neigh_get_or_create(struct batadv_hard_iface *hard_iface,
const u8 *neigh_addr) const u8 *neigh_addr)
{ {
struct batadv_hardif_neigh_node *hardif_neigh = NULL; struct batadv_hardif_neigh_node *hardif_neigh;
/* first check without locking to avoid the overhead */ /* first check without locking to avoid the overhead */
hardif_neigh = batadv_hardif_neigh_get(hard_iface, neigh_addr); hardif_neigh = batadv_hardif_neigh_get(hard_iface, neigh_addr);
...@@ -683,7 +683,7 @@ batadv_neigh_node_get_or_create(struct batadv_orig_node *orig_node, ...@@ -683,7 +683,7 @@ batadv_neigh_node_get_or_create(struct batadv_orig_node *orig_node,
struct batadv_hard_iface *hard_iface, struct batadv_hard_iface *hard_iface,
const u8 *neigh_addr) const u8 *neigh_addr)
{ {
struct batadv_neigh_node *neigh_node = NULL; struct batadv_neigh_node *neigh_node;
/* first check without locking to avoid the overhead */ /* first check without locking to avoid the overhead */
neigh_node = batadv_neigh_node_get(orig_node, hard_iface, neigh_addr); neigh_node = batadv_neigh_node_get(orig_node, hard_iface, neigh_addr);
...@@ -1021,7 +1021,7 @@ struct batadv_orig_node *batadv_orig_node_new(struct batadv_priv *bat_priv, ...@@ -1021,7 +1021,7 @@ struct batadv_orig_node *batadv_orig_node_new(struct batadv_priv *bat_priv,
batadv_orig_node_vlan_put(vlan); batadv_orig_node_vlan_put(vlan);
for (i = 0; i < BATADV_FRAG_BUFFER_COUNT; i++) { for (i = 0; i < BATADV_FRAG_BUFFER_COUNT; i++) {
INIT_HLIST_HEAD(&orig_node->fragments[i].head); INIT_HLIST_HEAD(&orig_node->fragments[i].fragment_list);
spin_lock_init(&orig_node->fragments[i].lock); spin_lock_init(&orig_node->fragments[i].lock);
orig_node->fragments[i].size = 0; orig_node->fragments[i].size = 0;
} }
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
#include <asm/byteorder.h> #include <asm/byteorder.h>
#include <linux/types.h> #include <linux/types.h>
#define batadv_tp_is_error(n) ((u8)n > 127 ? 1 : 0) #define batadv_tp_is_error(n) ((u8)(n) > 127 ? 1 : 0)
/** /**
* enum batadv_packettype - types for batman-adv encapsulated packets * enum batadv_packettype - types for batman-adv encapsulated packets
...@@ -251,16 +251,6 @@ struct batadv_elp_packet { ...@@ -251,16 +251,6 @@ struct batadv_elp_packet {
#define BATADV_ELP_HLEN sizeof(struct batadv_elp_packet) #define BATADV_ELP_HLEN sizeof(struct batadv_elp_packet)
/**
* enum batadv_icmp_user_cmd_type - types for batman-adv icmp cmd modes
* @BATADV_TP_START: start a throughput meter run
* @BATADV_TP_STOP: stop a throughput meter run
*/
enum batadv_icmp_user_cmd_type {
BATADV_TP_START = 0,
BATADV_TP_STOP = 2,
};
/** /**
* struct batadv_icmp_header - common members among all the ICMP packets * struct batadv_icmp_header - common members among all the ICMP packets
* @packet_type: batman-adv packet type, part of the general header * @packet_type: batman-adv packet type, part of the general header
......
...@@ -562,7 +562,7 @@ int batadv_add_bcast_packet_to_list(struct batadv_priv *bat_priv, ...@@ -562,7 +562,7 @@ int batadv_add_bcast_packet_to_list(struct batadv_priv *bat_priv,
const struct sk_buff *skb, const struct sk_buff *skb,
unsigned long delay) unsigned long delay)
{ {
struct batadv_hard_iface *primary_if = NULL; struct batadv_hard_iface *primary_if;
struct batadv_forw_packet *forw_packet; struct batadv_forw_packet *forw_packet;
struct batadv_bcast_packet *bcast_packet; struct batadv_bcast_packet *bcast_packet;
struct sk_buff *newskb; struct sk_buff *newskb;
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#include <linux/byteorder/generic.h> #include <linux/byteorder/generic.h>
#include <linux/cache.h> #include <linux/cache.h>
#include <linux/compiler.h> #include <linux/compiler.h>
#include <linux/cpumask.h>
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/etherdevice.h> #include <linux/etherdevice.h>
#include <linux/ethtool.h> #include <linux/ethtool.h>
...@@ -116,6 +117,26 @@ static int batadv_interface_release(struct net_device *dev) ...@@ -116,6 +117,26 @@ static int batadv_interface_release(struct net_device *dev)
return 0; return 0;
} }
/**
* batadv_sum_counter - Sum the cpu-local counters for index 'idx'
* @bat_priv: the bat priv with all the soft interface information
* @idx: index of counter to sum up
*
* Return: sum of all cpu-local counters
*/
static u64 batadv_sum_counter(struct batadv_priv *bat_priv, size_t idx)
{
u64 *counters, sum = 0;
int cpu;
for_each_possible_cpu(cpu) {
counters = per_cpu_ptr(bat_priv->bat_counters, cpu);
sum += counters[idx];
}
return sum;
}
static struct net_device_stats *batadv_interface_stats(struct net_device *dev) static struct net_device_stats *batadv_interface_stats(struct net_device *dev)
{ {
struct batadv_priv *bat_priv = netdev_priv(dev); struct batadv_priv *bat_priv = netdev_priv(dev);
......
...@@ -33,7 +33,6 @@ ...@@ -33,7 +33,6 @@
#include <linux/rcupdate.h> #include <linux/rcupdate.h>
#include <linux/rtnetlink.h> #include <linux/rtnetlink.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/stat.h>
#include <linux/stddef.h> #include <linux/stddef.h>
#include <linux/string.h> #include <linux/string.h>
#include <linux/stringify.h> #include <linux/stringify.h>
...@@ -666,41 +665,36 @@ static ssize_t batadv_store_isolation_mark(struct kobject *kobj, ...@@ -666,41 +665,36 @@ static ssize_t batadv_store_isolation_mark(struct kobject *kobj,
return count; return count;
} }
BATADV_ATTR_SIF_BOOL(aggregated_ogms, S_IRUGO | S_IWUSR, NULL); BATADV_ATTR_SIF_BOOL(aggregated_ogms, 0644, NULL);
BATADV_ATTR_SIF_BOOL(bonding, S_IRUGO | S_IWUSR, NULL); BATADV_ATTR_SIF_BOOL(bonding, 0644, NULL);
#ifdef CONFIG_BATMAN_ADV_BLA #ifdef CONFIG_BATMAN_ADV_BLA
BATADV_ATTR_SIF_BOOL(bridge_loop_avoidance, S_IRUGO | S_IWUSR, BATADV_ATTR_SIF_BOOL(bridge_loop_avoidance, 0644, batadv_bla_status_update);
batadv_bla_status_update);
#endif #endif
#ifdef CONFIG_BATMAN_ADV_DAT #ifdef CONFIG_BATMAN_ADV_DAT
BATADV_ATTR_SIF_BOOL(distributed_arp_table, S_IRUGO | S_IWUSR, BATADV_ATTR_SIF_BOOL(distributed_arp_table, 0644, batadv_dat_status_update);
batadv_dat_status_update);
#endif #endif
BATADV_ATTR_SIF_BOOL(fragmentation, S_IRUGO | S_IWUSR, batadv_update_min_mtu); BATADV_ATTR_SIF_BOOL(fragmentation, 0644, batadv_update_min_mtu);
static BATADV_ATTR(routing_algo, S_IRUGO, batadv_show_bat_algo, NULL); static BATADV_ATTR(routing_algo, 0444, batadv_show_bat_algo, NULL);
static BATADV_ATTR(gw_mode, S_IRUGO | S_IWUSR, batadv_show_gw_mode, static BATADV_ATTR(gw_mode, 0644, batadv_show_gw_mode, batadv_store_gw_mode);
batadv_store_gw_mode); BATADV_ATTR_SIF_UINT(orig_interval, orig_interval, 0644, 2 * BATADV_JITTER,
BATADV_ATTR_SIF_UINT(orig_interval, orig_interval, S_IRUGO | S_IWUSR, INT_MAX, NULL);
2 * BATADV_JITTER, INT_MAX, NULL); BATADV_ATTR_SIF_UINT(hop_penalty, hop_penalty, 0644, 0, BATADV_TQ_MAX_VALUE,
BATADV_ATTR_SIF_UINT(hop_penalty, hop_penalty, S_IRUGO | S_IWUSR, 0, NULL);
BATADV_TQ_MAX_VALUE, NULL); static BATADV_ATTR(gw_sel_class, 0644, batadv_show_gw_sel_class,
static BATADV_ATTR(gw_sel_class, S_IRUGO | S_IWUSR, batadv_show_gw_sel_class,
batadv_store_gw_sel_class); batadv_store_gw_sel_class);
static BATADV_ATTR(gw_bandwidth, S_IRUGO | S_IWUSR, batadv_show_gw_bwidth, static BATADV_ATTR(gw_bandwidth, 0644, batadv_show_gw_bwidth,
batadv_store_gw_bwidth); batadv_store_gw_bwidth);
#ifdef CONFIG_BATMAN_ADV_MCAST #ifdef CONFIG_BATMAN_ADV_MCAST
BATADV_ATTR_SIF_BOOL(multicast_mode, S_IRUGO | S_IWUSR, NULL); BATADV_ATTR_SIF_BOOL(multicast_mode, 0644, NULL);
#endif #endif
#ifdef CONFIG_BATMAN_ADV_DEBUG #ifdef CONFIG_BATMAN_ADV_DEBUG
BATADV_ATTR_SIF_UINT(log_level, log_level, S_IRUGO | S_IWUSR, 0, BATADV_ATTR_SIF_UINT(log_level, log_level, 0644, 0, BATADV_DBG_ALL, NULL);
BATADV_DBG_ALL, NULL);
#endif #endif
#ifdef CONFIG_BATMAN_ADV_NC #ifdef CONFIG_BATMAN_ADV_NC
BATADV_ATTR_SIF_BOOL(network_coding, S_IRUGO | S_IWUSR, BATADV_ATTR_SIF_BOOL(network_coding, 0644, batadv_nc_status_update);
batadv_nc_status_update);
#endif #endif
static BATADV_ATTR(isolation_mark, S_IRUGO | S_IWUSR, static BATADV_ATTR(isolation_mark, 0644, batadv_show_isolation_mark,
batadv_show_isolation_mark, batadv_store_isolation_mark); batadv_store_isolation_mark);
static struct batadv_attribute *batadv_mesh_attrs[] = { static struct batadv_attribute *batadv_mesh_attrs[] = {
&batadv_attr_aggregated_ogms, &batadv_attr_aggregated_ogms,
...@@ -731,7 +725,7 @@ static struct batadv_attribute *batadv_mesh_attrs[] = { ...@@ -731,7 +725,7 @@ static struct batadv_attribute *batadv_mesh_attrs[] = {
NULL, NULL,
}; };
BATADV_ATTR_VLAN_BOOL(ap_isolation, S_IRUGO | S_IWUSR, NULL); BATADV_ATTR_VLAN_BOOL(ap_isolation, 0644, NULL);
/* array of vlan specific sysfs attributes */ /* array of vlan specific sysfs attributes */
static struct batadv_attribute *batadv_vlan_attrs[] = { static struct batadv_attribute *batadv_vlan_attrs[] = {
...@@ -1116,14 +1110,13 @@ static ssize_t batadv_show_throughput_override(struct kobject *kobj, ...@@ -1116,14 +1110,13 @@ static ssize_t batadv_show_throughput_override(struct kobject *kobj,
#endif #endif
static BATADV_ATTR(mesh_iface, S_IRUGO | S_IWUSR, batadv_show_mesh_iface, static BATADV_ATTR(mesh_iface, 0644, batadv_show_mesh_iface,
batadv_store_mesh_iface); batadv_store_mesh_iface);
static BATADV_ATTR(iface_status, S_IRUGO, batadv_show_iface_status, NULL); static BATADV_ATTR(iface_status, 0444, batadv_show_iface_status, NULL);
#ifdef CONFIG_BATMAN_ADV_BATMAN_V #ifdef CONFIG_BATMAN_ADV_BATMAN_V
BATADV_ATTR_HIF_UINT(elp_interval, bat_v.elp_interval, S_IRUGO | S_IWUSR, BATADV_ATTR_HIF_UINT(elp_interval, bat_v.elp_interval, 0644,
2 * BATADV_JITTER, INT_MAX, NULL); 2 * BATADV_JITTER, INT_MAX, NULL);
static BATADV_ATTR(throughput_override, S_IRUGO | S_IWUSR, static BATADV_ATTR(throughput_override, 0644, batadv_show_throughput_override,
batadv_show_throughput_override,
batadv_store_throughput_override); batadv_store_throughput_override);
#endif #endif
......
...@@ -3835,8 +3835,8 @@ void batadv_tt_local_commit_changes(struct batadv_priv *bat_priv) ...@@ -3835,8 +3835,8 @@ void batadv_tt_local_commit_changes(struct batadv_priv *bat_priv)
bool batadv_is_ap_isolated(struct batadv_priv *bat_priv, u8 *src, u8 *dst, bool batadv_is_ap_isolated(struct batadv_priv *bat_priv, u8 *src, u8 *dst,
unsigned short vid) unsigned short vid)
{ {
struct batadv_tt_local_entry *tt_local_entry = NULL; struct batadv_tt_local_entry *tt_local_entry;
struct batadv_tt_global_entry *tt_global_entry = NULL; struct batadv_tt_global_entry *tt_global_entry;
struct batadv_softif_vlan *vlan; struct batadv_softif_vlan *vlan;
bool ret = false; bool ret = false;
...@@ -3845,27 +3845,24 @@ bool batadv_is_ap_isolated(struct batadv_priv *bat_priv, u8 *src, u8 *dst, ...@@ -3845,27 +3845,24 @@ bool batadv_is_ap_isolated(struct batadv_priv *bat_priv, u8 *src, u8 *dst,
return false; return false;
if (!atomic_read(&vlan->ap_isolation)) if (!atomic_read(&vlan->ap_isolation))
goto out; goto vlan_put;
tt_local_entry = batadv_tt_local_hash_find(bat_priv, dst, vid); tt_local_entry = batadv_tt_local_hash_find(bat_priv, dst, vid);
if (!tt_local_entry) if (!tt_local_entry)
goto out; goto vlan_put;
tt_global_entry = batadv_tt_global_hash_find(bat_priv, src, vid); tt_global_entry = batadv_tt_global_hash_find(bat_priv, src, vid);
if (!tt_global_entry) if (!tt_global_entry)
goto out; goto local_entry_put;
if (!_batadv_is_ap_isolated(tt_local_entry, tt_global_entry))
goto out;
ret = true; if (_batadv_is_ap_isolated(tt_local_entry, tt_global_entry))
ret = true;
out: batadv_tt_global_entry_put(tt_global_entry);
local_entry_put:
batadv_tt_local_entry_put(tt_local_entry);
vlan_put:
batadv_softif_vlan_put(vlan); batadv_softif_vlan_put(vlan);
if (tt_global_entry)
batadv_tt_global_entry_put(tt_global_entry);
if (tt_local_entry)
batadv_tt_local_entry_put(tt_local_entry);
return ret; return ret;
} }
......
...@@ -184,7 +184,7 @@ struct batadv_orig_ifinfo { ...@@ -184,7 +184,7 @@ struct batadv_orig_ifinfo {
/** /**
* struct batadv_frag_table_entry - head in the fragment buffer table * struct batadv_frag_table_entry - head in the fragment buffer table
* @head: head of list with fragments * @fragment_list: head of list with fragments
* @lock: lock to protect the list of fragments * @lock: lock to protect the list of fragments
* @timestamp: time (jiffie) of last received fragment * @timestamp: time (jiffie) of last received fragment
* @seqno: sequence number of the fragments in the list * @seqno: sequence number of the fragments in the list
...@@ -192,8 +192,8 @@ struct batadv_orig_ifinfo { ...@@ -192,8 +192,8 @@ struct batadv_orig_ifinfo {
* @total_size: expected size of the assembled packet * @total_size: expected size of the assembled packet
*/ */
struct batadv_frag_table_entry { struct batadv_frag_table_entry {
struct hlist_head head; struct hlist_head fragment_list;
spinlock_t lock; /* protects head */ spinlock_t lock; /* protects fragment_list */
unsigned long timestamp; unsigned long timestamp;
u16 seqno; u16 seqno;
u16 size; u16 size;
...@@ -706,8 +706,8 @@ struct batadv_priv_debug_log { ...@@ -706,8 +706,8 @@ struct batadv_priv_debug_log {
/** /**
* struct batadv_priv_gw - per mesh interface gateway data * struct batadv_priv_gw - per mesh interface gateway data
* @list: list of available gateway nodes * @gateway_list: list of available gateway nodes
* @list_lock: lock protecting gw_list & curr_gw * @list_lock: lock protecting gateway_list & curr_gw
* @curr_gw: pointer to currently selected gateway node * @curr_gw: pointer to currently selected gateway node
* @mode: gateway operation: off, client or server (see batadv_gw_modes) * @mode: gateway operation: off, client or server (see batadv_gw_modes)
* @sel_class: gateway selection class (applies if gw_mode client) * @sel_class: gateway selection class (applies if gw_mode client)
...@@ -716,8 +716,8 @@ struct batadv_priv_debug_log { ...@@ -716,8 +716,8 @@ struct batadv_priv_debug_log {
* @reselect: bool indicating a gateway re-selection is in progress * @reselect: bool indicating a gateway re-selection is in progress
*/ */
struct batadv_priv_gw { struct batadv_priv_gw {
struct hlist_head list; struct hlist_head gateway_list;
spinlock_t list_lock; /* protects gw_list & curr_gw */ spinlock_t list_lock; /* protects gateway_list & curr_gw */
struct batadv_gw_node __rcu *curr_gw; /* rcu protected pointer */ struct batadv_gw_node __rcu *curr_gw; /* rcu protected pointer */
atomic_t mode; atomic_t mode;
atomic_t sel_class; atomic_t sel_class;
...@@ -1363,7 +1363,7 @@ struct batadv_skb_cb { ...@@ -1363,7 +1363,7 @@ struct batadv_skb_cb {
/** /**
* struct batadv_forw_packet - structure for bcast packets to be sent/forwarded * struct batadv_forw_packet - structure for bcast packets to be sent/forwarded
* @list: list node for batadv_socket_client::queue_list * @list: list node for batadv_priv::forw_{bat,bcast}_list
* @send_time: execution time for delayed_work (packet sending) * @send_time: execution time for delayed_work (packet sending)
* @own: bool for locally generated packets (local OGMs are re-scheduled after * @own: bool for locally generated packets (local OGMs are re-scheduled after
* sending) * sending)
......
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