pull request: batman-adv 2011-06-09
Subsystems (3)
Hi,
I would like to propose following changes for net-next-2.6/3.1. Most patches are simple cleanup patches and only Daniele Furlan provided an enhancement which should fix some routing decisions when a mesh node is overloaded and OGMs get delayed.
Thanks,
Sven
The following changes since commit bb899b89f46eb1fd6f62a4c360f6511b9714e479:
batman-adv: Ensure that we really have route changes in update_route (2011-05-30 07:39:37 +0200)
are available in the git repository at:
git://git.open-mesh.org/ecsv/linux-merge.git batman-adv/next
Daniele Furlan (1):
batman-adv: accept delayed rebroadcasts to avoid bogus routing under heavy load
Marek Lindner (1):
batman-adv: use NO_FLAGS define instead of hard-coding 0
Sven Eckelmann (4):
batman-adv: Don't return value in void function
batman-adv: Fix signedness problem in parse_gw_bandwidth
batman-adv: Rewrite debugfs kobj_to_* helpers as functions
batman-adv: Use enums for related constants
net/batman-adv/aggregation.c | 2 +- net/batman-adv/bat_sysfs.c | 14 +++++++++-- net/batman-adv/gateway_client.c | 6 ++-- net/batman-adv/gateway_common.c | 4 +- net/batman-adv/hard-interface.c | 2 +- net/batman-adv/hard-interface.h | 14 ++++++----- net/batman-adv/main.h | 19 ++++++++++----- net/batman-adv/packet.h | 47 ++++++++++++++++++++++++--------------- net/batman-adv/routing.c | 9 +++---- net/batman-adv/send.c | 2 +- 10 files changed, 72 insertions(+), 47 deletions(-)
A message that is not in the archive (sent off-list or not yet received): 1307653754-5014-1-git-send-email-sven-KaDOiPu9UxWEi8DpZVb4nw@public.gmane.org
PATCH 1/6 batman-adv: accept delayed rebroadcasts to avoid bogus routing under heavy load
From: Daniele Furlan <[email protected]>
When a link is saturated (re)broadcasts of OGMs are delayed. Under heavy load this delay may exceed the orig interval which leads to OGMs being dropped (the code would only accept an OGM rebroadcast if it arrived before the next OGM was broadcasted). With this patch batman-adv will also accept delayed OGMs in order to avoid a bogus influence on the routing metric.
--- net/batman-adv/routing.c | 9 ++++----- 1 files changed, 4 insertions(+), 5 deletions(-)
net/batman-adv/routing.c +4 -5
@@ -698,17 +698,16 @@ void receive_bat_packet(const struct ethhdr *ethhdr,/* neighbor has to indicate direct link and it has to * come via the corresponding interface */ -/* if received seqno equals last send seqno save new -* seqno for bidirectional check */ +/* save packet seqno for bidirectional check */ if (has_directlink_flag &&compare_eth (if_incoming->net_dev->dev_addr, - batman_packet->orig) && - (batman_packet->seqno - if_incoming_seqno +2 ==0 )) { + batman_packet->orig)) { offset = if_incoming->if_num *NUM_WORDS ;spin_lock_bh (&orig_neigh_node->ogm_cnt_lock); word = &(orig_neigh_node->bcast_own[offset]); -bit_mark (word,0 ); +bit_mark (word, + if_incoming_seqno - batman_packet->seqno -2 ); orig_neigh_node->bcast_own_sum[if_incoming->if_num] =bit_packet_count (word);spin_unlock_bh (&orig_neigh_node->ogm_cnt_lock);
Signature · 1 line
1.7.5.3
PATCH 3/6 batman-adv: Fix signedness problem in parse_gw_bandwidth
In reply to a message not in the archivestrict_strtoul as used in parse_gw_bandwidth is defined for unsigned long and strict_strtol should be used instead for long.
--- net/batman-adv/gateway_common.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
net/batman-adv/gateway_common.c +2 -2
@@ -97,7 +97,7 @@ static bool parse_gw_bandwidth(struct net_device *net_dev, char *buff, *tmp_ptr ='\0' ; } - ret =strict_strtoul (buff,10 , &ldown); + ret =strict_strtol (buff,10 , &ldown);if (ret) { bat_err(net_dev, "Download speed of gateway mode invalid: %s\n",
@@ -122,7 +122,7 @@ static bool parse_gw_bandwidth(struct net_device *net_dev, char *buff, *tmp_ptr ='\0' ; } - ret =strict_strtoul (slash_ptr +1 ,10 , &lup); + ret =strict_strtol (slash_ptr +1 ,10 , &lup);if (ret) {bat_err (net_dev, "Upload speed of gateway mode invalid: "
Signature · 1 line
1.7.5.3
PATCH 4/6 batman-adv: Rewrite debugfs kobj_to_* helpers as functions
In reply to a message not in the archiveCodingStyle "Chapter 12: Macros, Enums and RTL" highly recommends to use functions instead of macros were possible. This ensures type safety and prevents shadowing of other variables.
--- net/batman-adv/bat_sysfs.c | 14 +++++++++++--- 1 files changed, 11 insertions(+), 3 deletions(-)
net/batman-adv/bat_sysfs.c +11 -3
@@ -28,9 +28,17 @@#include "gateway_client.h" #include "vis.h" -#define to_dev (obj) container_of(obj, struct device, kobj) -#define kobj_to_netdev (obj) to_net_dev(to_dev(obj->parent)) -#define kobj_to_batpriv (obj) netdev_priv(kobj_to_netdev(obj)) +static struct net_device *kobj_to_netdev (struct kobject *obj) +{ + struct device *dev = container_of(obj->parent, struct device, kobj); +return to_net_dev (dev); +} + +static struct bat_priv *kobj_to_batpriv (struct kobject *obj) +{ +struct net_device *net_dev =kobj_to_netdev (obj); +return netdev_priv (net_dev); +}/* Use this, if you have customized show and store functions */ #define BAT_ATTR (_name, _mode, _show, _store) \
Signature · 1 line
1.7.5.3
PATCH 5/6 batman-adv: Use enums for related constants
In reply to a message not in the archiveCodingStyle "Chapter 12: Macros, Enums and RTL" recommends to use enums for several related constants. Internal states can be used without defining the actual value, but all values which are visible to the outside must be defined as before. Normal values are assigned as usual and flags are defined by shifts of a bit.
--- net/batman-adv/hard-interface.h | 14 ++++++----- net/batman-adv/main.h | 17 ++++++++----- net/batman-adv/packet.h | 47 ++++++++++++++++++++++++--------------- 3 files changed, 47 insertions(+), 31 deletions(-)
net/batman-adv/hard-interface.h +8 -6
@@ -22,12 +22,14 @@#ifndef _NET_BATMAN_ADV_HARD_INTERFACE_H_#define _NET_BATMAN_ADV_HARD_INTERFACE_H_ -#define IF_NOT_IN_USE 0 -#define IF_TO_BE_REMOVED 1 -#define IF_INACTIVE 2 -#define IF_ACTIVE 3 -#define IF_TO_BE_ACTIVATED 4 -#define IF_I_WANT_YOU 5 +enum hard_if_state { +IF_NOT_IN_USE , +IF_TO_BE_REMOVED , +IF_INACTIVE , +IF_ACTIVE , +IF_TO_BE_ACTIVATED , +IF_I_WANT_YOU +};extern struct notifier_block hard_if_notifier;
net/batman-adv/main.h +10 -7
@@ -72,9 +72,11 @@#define RESET_PROTECTION_MS 30000#define EXPECTED_SEQNO_RANGE 65536 -#define MESH_INACTIVE 0 -#define MESH_ACTIVE 1 -#define MESH_DEACTIVATING 2 +enum mesh_state { +MESH_INACTIVE , +MESH_ACTIVE , +MESH_DEACTIVATING +};#define BCAST_QUEUE_LEN 256#define BATMAN_QUEUE_LEN 256
@@ -89,10 +91,11 @@#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt/* all messages related to routing / flooding / broadcasting / etc */ -#define DBG_BATMAN 1 -/* route or tt entry added / changed / deleted */ -#define DBG_ROUTES 2 -#define DBG_ALL 3 +enum dbg_level { +DBG_BATMAN =1 <<0 , +DBG_ROUTES =1 <<1 ,/* route added / changed / deleted */ +DBG_ALL =3 +};/*
net/batman-adv/packet.h +29 -18
62 lines not on this page · raw message
Signature · 1 line
1.7.5.3
PATCH 6/6 batman-adv: use NO_FLAGS define instead of hard-coding 0
In reply to a message not in the archiveFrom: Marek Lindner <[email protected]>
The definition NO_FLAGS was introduced to make the code more readable and shall be used to initialize flag fields.
--- net/batman-adv/aggregation.c | 2 +- net/batman-adv/gateway_client.c | 4 ++-- net/batman-adv/hard-interface.c | 2 +- net/batman-adv/main.h | 2 ++ net/batman-adv/send.c | 2 +- 5 files changed, 7 insertions(+), 5 deletions(-)
net/batman-adv/aggregation.c +1 -1
@@ -151,7 +151,7 @@ static void new_aggregated_packet(const unsigned char *packet_buff, forw_packet_aggr->own = own_packet; forw_packet_aggr->if_incoming = if_incoming; forw_packet_aggr->num_packets =0 ; - forw_packet_aggr->direct_link_flags =0 ; + forw_packet_aggr->direct_link_flags =NO_FLAGS ; forw_packet_aggr->send_time = send_time;/* save packet direct link flag status */
net/batman-adv/gateway_client.c +2 -2
@@ -322,7 +322,7 @@ void gw_node_update(struct bat_priv *bat_priv, gw_node->deleted =0 ; -if (new_gwflags ==0 ) { +if (new_gwflags ==NO_FLAGS ) { gw_node->deleted = jiffies; bat_dbg(DBG_BATMAN, bat_priv, "Gateway %pM removed from gateway list\n",
@@ -335,7 +335,7 @@ void gw_node_update(struct bat_priv *bat_priv, goto unlock; } -if (new_gwflags ==0 ) +if (new_gwflags ==NO_FLAGS ) goto unlock;gw_node_add (bat_priv, orig_node, new_gwflags);
net/batman-adv/hard-interface.c +1 -1
@@ -337,7 +337,7 @@ int hardif_enable_interface(struct hard_iface *hard_iface, batman_packet = (struct batman_packet *)(hard_iface->packet_buff); batman_packet->packet_type =BAT_PACKET ; batman_packet->version =COMPAT_VERSION ; - batman_packet->flags =0 ; + batman_packet->flags =NO_FLAGS ; batman_packet->ttl =2 ; batman_packet->tq =TQ_MAX_VALUE ; batman_packet->num_tt =0 ;
net/batman-adv/main.h +2 -0
@@ -51,6 +51,8 @@#define TQ_LOCAL_BIDRECT_RECV_MINIMUM 1#define TQ_TOTAL_BIDRECT_LIMIT 1 +#define NO_FLAGS 0 +#define NUM_WORDS (TQ_LOCAL_WINDOW_SIZE / WORD_BIT_SIZE)#define LOG_BUF_LEN 8192/* has to be a power of 2 */
net/batman-adv/send.c +1 -1
@@ -289,7 +289,7 @@ void schedule_own_packet(struct hard_iface *hard_iface) batman_packet->gw_flags = (uint8_t )atomic_read (&bat_priv->gw_bandwidth); else - batman_packet->gw_flags = 0; + batman_packet->gw_flags = NO_FLAGS;atomic_inc (&hard_iface->seqno);
Signature · 1 line
1.7.5.3
From: Sven Eckelmann <[email protected]>
Date: Thu, 9 Jun 2011 23:09:08 +0200
Quoted 6 lines
Hi,
I would like to propose following changes for net-next-2.6/3.1. Most patches are simple cleanup patches and only Daniele Furlan provided an enhancement which should fix some routing decisions when a mesh node is overloaded and OGMs get delayed.
Pulled, thanks Sven.
Sven Eckelmann
maintainerPATCH 2/6 batman-adv: Don't return value in void function
In reply to Sven Eckelmanngw_node_delete is defined with "void" as return type, but still tries to return a value. The called function gw_node_delete is also return as void and thus doesn't provide a value for us.
--- net/batman-adv/gateway_client.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
net/batman-adv/gateway_client.c +1 -1
@@ -352,7 +352,7 @@ unlock:void gw_node_delete (struct bat_priv *bat_priv,struct orig_node *orig_node) { -return gw_node_update (bat_priv, orig_node,0 ); +gw_node_update (bat_priv, orig_node,0 ); }void gw_node_purge (struct bat_priv *bat_priv)
Signature · 1 line
1.7.5.3