batman-adv; branch, master, updated. v2012.1.0-113-g2f29426
by postmaster@open-mesh.org
The following commit has been merged in the master branch:
commit 2f294260f38c0a283e1c90d2816a2db43c8f8be6
Author: Sven Eckelmann <sven(a)narfation.org>
Date: Sat May 5 13:27:28 2012 +0200
batman-adv: Return error codes instead of -1 on failures
Signed-off-by: Sven Eckelmann <sven(a)narfation.org>
diff --git a/bat_sysfs.c b/bat_sysfs.c
index acb2640..6ba3d89 100644
--- a/bat_sysfs.c
+++ b/bat_sysfs.c
@@ -680,7 +680,7 @@ void sysfs_del_hardif(struct kobject **hardif_obj)
int throw_uevent(struct bat_priv *bat_priv, enum uev_type type,
enum uev_action action, const char *data)
{
- int ret = -1;
+ int ret = -ENOMEM;
struct hard_iface *primary_if = NULL;
struct kobject *bat_kobj;
char *uevent_env[4] = { NULL, NULL, NULL, NULL };
diff --git a/bridge_loop_avoidance.c b/bridge_loop_avoidance.c
index 48831c2..89e9721 100644
--- a/bridge_loop_avoidance.c
+++ b/bridge_loop_avoidance.c
@@ -1164,13 +1164,13 @@ int bla_init(struct bat_priv *bat_priv)
bat_priv->bcast_duplist_curr = 0;
if (bat_priv->claim_hash)
- return 1;
+ return 0;
bat_priv->claim_hash = hash_new(128);
bat_priv->backbone_hash = hash_new(32);
if (!bat_priv->claim_hash || !bat_priv->backbone_hash)
- return -1;
+ return -ENOMEM;
hash_set_lock_class(bat_priv->claim_hash, &claim_hash_lock_class_key);
hash_set_lock_class(bat_priv->backbone_hash,
@@ -1179,7 +1179,7 @@ int bla_init(struct bat_priv *bat_priv)
bat_dbg(DBG_BLA, bat_priv, "bla hashes initialized\n");
bla_start_timer(bat_priv);
- return 1;
+ return 0;
}
/**
diff --git a/main.c b/main.c
index 79dd604..805373f 100644
--- a/main.c
+++ b/main.c
@@ -92,6 +92,7 @@ static void __exit batman_exit(void)
int mesh_init(struct net_device *soft_iface)
{
struct bat_priv *bat_priv = netdev_priv(soft_iface);
+ int ret;
spin_lock_init(&bat_priv->forw_bat_list_lock);
spin_lock_init(&bat_priv->forw_bcast_list_lock);
@@ -110,30 +111,32 @@ int mesh_init(struct net_device *soft_iface)
INIT_LIST_HEAD(&bat_priv->tt_req_list);
INIT_LIST_HEAD(&bat_priv->tt_roam_list);
- if (originator_init(bat_priv) < 1)
+ ret = originator_init(bat_priv);
+ if (ret < 0)
goto err;
- if (tt_init(bat_priv) < 1)
+ ret = tt_init(bat_priv);
+ if (ret < 0)
goto err;
tt_local_add(soft_iface, soft_iface->dev_addr, NULL_IFINDEX);
- if (vis_init(bat_priv) < 1)
+ ret = vis_init(bat_priv);
+ if (ret < 0)
goto err;
- if (bla_init(bat_priv) < 1)
+ ret = bla_init(bat_priv);
+ if (ret < 0)
goto err;
atomic_set(&bat_priv->gw_reselect, 0);
atomic_set(&bat_priv->mesh_state, MESH_ACTIVE);
- goto end;
+
+ return 0;
err:
mesh_free(soft_iface);
- return -1;
-
-end:
- return 0;
+ return ret;
}
void mesh_free(struct net_device *soft_iface)
@@ -321,12 +324,13 @@ static struct bat_algo_ops *bat_algo_get(char *name)
int bat_algo_register(struct bat_algo_ops *bat_algo_ops)
{
struct bat_algo_ops *bat_algo_ops_tmp;
- int ret = -1;
+ int ret;
bat_algo_ops_tmp = bat_algo_get(bat_algo_ops->name);
if (bat_algo_ops_tmp) {
pr_info("Trying to register already registered routing algorithm: %s\n",
bat_algo_ops->name);
+ ret = -EEXIST;
goto out;
}
@@ -339,6 +343,7 @@ int bat_algo_register(struct bat_algo_ops *bat_algo_ops)
!bat_algo_ops->bat_ogm_emit) {
pr_info("Routing algo '%s' does not implement required ops\n",
bat_algo_ops->name);
+ ret = -EINVAL;
goto out;
}
@@ -353,7 +358,7 @@ out:
int bat_algo_select(struct bat_priv *bat_priv, char *name)
{
struct bat_algo_ops *bat_algo_ops;
- int ret = -1;
+ int ret = -EINVAL;
bat_algo_ops = bat_algo_get(name);
if (!bat_algo_ops)
diff --git a/originator.c b/originator.c
index 30889c9..61e091d 100644
--- a/originator.c
+++ b/originator.c
@@ -51,7 +51,7 @@ static int compare_orig(const struct hlist_node *node, const void *data2)
int originator_init(struct bat_priv *bat_priv)
{
if (bat_priv->orig_hash)
- return 1;
+ return 0;
bat_priv->orig_hash = hash_new(1024);
@@ -59,10 +59,10 @@ int originator_init(struct bat_priv *bat_priv)
goto err;
start_purge_timer(bat_priv);
- return 1;
+ return 0;
err:
- return 0;
+ return -ENOMEM;
}
void neigh_node_free_ref(struct neigh_node *neigh_node)
@@ -489,7 +489,7 @@ static int orig_node_add_if(struct orig_node *orig_node, int max_if_num)
data_ptr = kmalloc(max_if_num * sizeof(unsigned long) * NUM_WORDS,
GFP_ATOMIC);
if (!data_ptr)
- return -1;
+ return -ENOMEM;
memcpy(data_ptr, orig_node->bcast_own,
(max_if_num - 1) * sizeof(unsigned long) * NUM_WORDS);
@@ -498,7 +498,7 @@ static int orig_node_add_if(struct orig_node *orig_node, int max_if_num)
data_ptr = kmalloc(max_if_num * sizeof(uint8_t), GFP_ATOMIC);
if (!data_ptr)
- return -1;
+ return -ENOMEM;
memcpy(data_ptr, orig_node->bcast_own_sum,
(max_if_num - 1) * sizeof(uint8_t));
@@ -529,7 +529,7 @@ int orig_hash_add_if(struct hard_iface *hard_iface, int max_if_num)
ret = orig_node_add_if(orig_node, max_if_num);
spin_unlock_bh(&orig_node->ogm_cnt_lock);
- if (ret == -1)
+ if (ret == -ENOMEM)
goto err;
}
rcu_read_unlock();
@@ -555,7 +555,7 @@ static int orig_node_del_if(struct orig_node *orig_node,
chunk_size = sizeof(unsigned long) * NUM_WORDS;
data_ptr = kmalloc(max_if_num * chunk_size, GFP_ATOMIC);
if (!data_ptr)
- return -1;
+ return -ENOMEM;
/* copy first part */
memcpy(data_ptr, orig_node->bcast_own, del_if_num * chunk_size);
@@ -574,7 +574,7 @@ free_bcast_own:
data_ptr = kmalloc(max_if_num * sizeof(uint8_t), GFP_ATOMIC);
if (!data_ptr)
- return -1;
+ return -ENOMEM;
memcpy(data_ptr, orig_node->bcast_own_sum,
del_if_num * sizeof(uint8_t));
@@ -613,7 +613,7 @@ int orig_hash_del_if(struct hard_iface *hard_iface, int max_if_num)
hard_iface->if_num);
spin_unlock_bh(&orig_node->ogm_cnt_lock);
- if (ret == -1)
+ if (ret == -ENOMEM)
goto err;
}
rcu_read_unlock();
diff --git a/translation-table.c b/translation-table.c
index 88c62f1..6743a66 100644
--- a/translation-table.c
+++ b/translation-table.c
@@ -181,14 +181,14 @@ int tt_len(int changes_num)
static int tt_local_init(struct bat_priv *bat_priv)
{
if (bat_priv->tt_local_hash)
- return 1;
+ return 0;
bat_priv->tt_local_hash = hash_new(1024);
if (!bat_priv->tt_local_hash)
- return 0;
+ return -ENOMEM;
- return 1;
+ return 0;
}
void tt_local_add(struct net_device *soft_iface, const uint8_t *addr,
@@ -491,14 +491,14 @@ static void tt_local_table_free(struct bat_priv *bat_priv)
static int tt_global_init(struct bat_priv *bat_priv)
{
if (bat_priv->tt_global_hash)
- return 1;
+ return 0;
bat_priv->tt_global_hash = hash_new(1024);
if (!bat_priv->tt_global_hash)
- return 0;
+ return -ENOMEM;
- return 1;
+ return 0;
}
static void tt_changes_list_free(struct bat_priv *bat_priv)
@@ -1773,11 +1773,15 @@ out:
int tt_init(struct bat_priv *bat_priv)
{
- if (!tt_local_init(bat_priv))
- return 0;
+ int ret;
- if (!tt_global_init(bat_priv))
- return 0;
+ ret = tt_local_init(bat_priv);
+ if (ret < 0)
+ return ret;
+
+ ret = tt_global_init(bat_priv);
+ if (ret < 0)
+ return ret;
tt_start_timer(bat_priv);
diff --git a/vis.c b/vis.c
index cec216f..411c0e1 100644
--- a/vis.c
+++ b/vis.c
@@ -626,7 +626,7 @@ static int generate_vis_packet(struct bat_priv *bat_priv)
best_tq = find_best_vis_server(bat_priv, info);
if (best_tq < 0)
- return -1;
+ return best_tq;
}
for (i = 0; i < hash->size; i++) {
@@ -878,7 +878,7 @@ int vis_init(struct bat_priv *bat_priv)
int hash_added;
if (bat_priv->vis_hash)
- return 1;
+ return 0;
spin_lock_bh(&bat_priv->vis_hash_lock);
@@ -929,7 +929,7 @@ int vis_init(struct bat_priv *bat_priv)
spin_unlock_bh(&bat_priv->vis_hash_lock);
start_vis_timer(bat_priv);
- return 1;
+ return 0;
free_info:
kfree(bat_priv->my_vis_info);
@@ -937,7 +937,7 @@ free_info:
err:
spin_unlock_bh(&bat_priv->vis_hash_lock);
vis_quit(bat_priv);
- return 0;
+ return -ENOMEM;
}
/* Decrease the reference count on a hash item info */
--
batman-adv
10 years, 1 month
batman-adv; branch, master, updated. v2012.1.0-112-gaf01e99
by postmaster@open-mesh.org
The following commit has been merged in the master branch:
commit af01e991adc9ad97110c0468474101f37bbc95cc
Author: Sven Eckelmann <sven(a)narfation.org>
Date: Sat May 5 13:27:27 2012 +0200
batman-adv: Only set hash class after hash is initialized
We must be sure that there was no error during the creation of the hash before
we can set the hash lock class. The class set function was added to the wrong
place in 2c9aa3b4c37bd55148f5f25212c89e7bf5f28497
Signed-off-by: Sven Eckelmann <sven(a)narfation.org>
diff --git a/bridge_loop_avoidance.c b/bridge_loop_avoidance.c
index 8bb274b..48831c2 100644
--- a/bridge_loop_avoidance.c
+++ b/bridge_loop_avoidance.c
@@ -1169,13 +1169,13 @@ int bla_init(struct bat_priv *bat_priv)
bat_priv->claim_hash = hash_new(128);
bat_priv->backbone_hash = hash_new(32);
+ if (!bat_priv->claim_hash || !bat_priv->backbone_hash)
+ return -1;
+
hash_set_lock_class(bat_priv->claim_hash, &claim_hash_lock_class_key);
hash_set_lock_class(bat_priv->backbone_hash,
&backbone_hash_lock_class_key);
- if (!bat_priv->claim_hash || !bat_priv->backbone_hash)
- return -1;
-
bat_dbg(DBG_BLA, bat_priv, "bla hashes initialized\n");
bla_start_timer(bat_priv);
--
batman-adv
10 years, 1 month
batman-adv; branch, master, updated. v2012.1.0-111-g515bdd0
by postmaster@open-mesh.org
The following commit has been merged in the master branch:
commit 2974b1dd3fe2238114b18302e6ad941cc2210dc4
Merge: 8237b119981c9d7c01029b1a8fe90c04fad5459d 832de22833248409585cf143cfdd16c80b74d04b
Author: Marek Lindner <lindner_marek(a)yahoo.de>
Date: Sun Apr 29 16:34:27 2012 +0800
Merge branch 'next'
diff --combined distributed-arp-table.h
index 12cedd5,6c0acde..bf72275
--- a/distributed-arp-table.h
+++ b/distributed-arp-table.h
@@@ -29,14 -29,14 +29,14 @@@
#include <linux/if_arp.h>
- #define DAT_ADDR_MAX biggest_unsigned_int(dat_addr_t)
+ #define DAT_ADDR_MAX ((dat_addr_t)~(dat_addr_t)0)
#define ARP_HW_SRC(skb, hdr_size) ((uint8_t *)(skb->data + hdr_size) + \
ETH_HLEN + sizeof(struct arphdr))
-#define ARP_IP_SRC(skb, hdr_size) (*(uint32_t *)(ARP_HW_SRC(skb, hdr_size) + \
+#define ARP_IP_SRC(skb, hdr_size) (*(__be32 *)(ARP_HW_SRC(skb, hdr_size) + \
ETH_ALEN))
#define ARP_HW_DST(skb, hdr_size) (ARP_HW_SRC(skb, hdr_size) + ETH_ALEN + 4)
-#define ARP_IP_DST(skb, hdr_size) (*(uint32_t *)(ARP_HW_SRC(skb, hdr_size) + \
+#define ARP_IP_DST(skb, hdr_size) (*(__be32 *)(ARP_HW_SRC(skb, hdr_size) + \
ETH_ALEN * 2 + 4))
bool dat_snoop_outgoing_arp_request(struct bat_priv *bat_priv,
diff --combined main.h
index c893c25,426a0d5..a94ceae
--- a/main.h
+++ b/main.h
@@@ -151,7 -151,6 +151,7 @@@ enum dbg_level
#include <linux/kthread.h> /* kernel threads */
#include <linux/pkt_sched.h> /* schedule types */
#include <linux/workqueue.h> /* workqueue */
+#include <linux/percpu.h>
#include <linux/slab.h>
#include <net/sock.h> /* struct sock */
#include <linux/jiffies.h>
@@@ -242,9 -241,6 +242,6 @@@ static inline bool has_timed_out(unsign
/* Returns the smallest signed integer in two's complement with the sizeof x */
#define smallest_signed_int(x) (1u << (7u + 8u * (sizeof(x) - 1u)))
- /* Returns the biggest unsigned integer with the sizeof x */
- #define biggest_unsigned_int(x) (~(x)0)
-
/* Checks if a sequence number x is a predecessor/successor of y.
* they handle overflows/underflows and can correctly check for a
* predecessor/successor unless the variable sequence number has grown by
@@@ -261,30 -257,4 +258,30 @@@
_dummy > smallest_signed_int(_dummy); })
#define seq_after(x, y) seq_before(y, x)
+/* Stop preemption on local cpu while incrementing the counter */
+static inline void add_counter(struct bat_priv *bat_priv, size_t idx,
+ size_t count)
+{
+ int cpu = get_cpu();
+ per_cpu_ptr(bat_priv->bat_counters, cpu)[idx] += count;
+ put_cpu();
+}
+
+#define inc_counter(b, i) add_counter(b, i, 1)
+
+/* Sum and return the cpu-local counters for index 'idx' */
+static inline uint64_t sum_counter(struct bat_priv *bat_priv, size_t idx)
+{
+ uint64_t *counters;
+ int cpu;
+ int sum = 0;
+
+ for_each_possible_cpu(cpu) {
+ counters = per_cpu_ptr(bat_priv->bat_counters, cpu);
+ sum += counters[idx];
+ }
+
+ return sum;
+}
+
#endif /* _NET_BATMAN_ADV_MAIN_H_ */
--
batman-adv
10 years, 1 month
batman-adv; branch, master, updated. v2012.1.0-111-g515bdd0
by postmaster@open-mesh.org
The following commit has been merged in the master branch:
commit 515bdd0d7e0913e0d4c5e4e526248465f2ead39c
Author: Martin Hundebøll <martin(a)hundeboll.net>
Date: Thu May 3 10:15:07 2012 +0200
] batman-adv: Change "make install" path and run depmod
Currently, when installing the out-of-tree module on distributions that
use gzipped modules, batman-adv.ko will be installed next to
batman-adv.ko.gz, which is selected by kmod.
By changing the install path to
/lib/modules/`uname -r`/updates/net/batman-adv/
and running "depmod -a", we make the newly installed module used by
kmod.
Signed-off-by: Martin Hundebøll <martin(a)hundeboll.net>
diff --git a/Makefile b/Makefile
index ac84fba..57530db 100644
--- a/Makefile
+++ b/Makefile
@@ -55,7 +55,8 @@ clean:
$(MAKE) -C $(KERNELPATH) M=$(PWD) PWD=$(PWD) clean
install: config
- $(MAKE) -C $(KERNELPATH) M=$(PWD) PWD=$(PWD) INSTALL_MOD_DIR=kernel/net/batman-adv/ modules_install
+ $(MAKE) -C $(KERNELPATH) M=$(PWD) PWD=$(PWD) INSTALL_MOD_DIR=updates/net/batman-adv/ modules_install
+ depmod -a
config:
$(PWD)/gen-compat-autoconf.sh $(PWD)/compat-autoconf.h
--
batman-adv
10 years, 1 month
linux integration; annotated tag, batman-adv-for-davem, updated. batman-adv-for-davem
by postmaster@open-mesh.org
The annotated tag, batman-adv-for-davem has been updated
to 0177649f776ef82b4b4ceb73d5e7b926b24e5af1 (tag)
from ad1c8b0817e002e9901b44be822a90251713fadb (which is now obsolete)
tagging 969e62ad00763fed9ea28700ef7a7d97fdbfddf3 (commit)
replaces v3.4-rc4
tagged by Antonio Quartulli
on Tue May 1 09:49:12 2012 +0200
- Shortlog ------------------------------------------------------------
Included changes:
* minor fixes and cleanups
* minor routing protocol API cleanups
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.19 (GNU/Linux)
iQEcBAABAgAGBQJPn5WIAAoJEFMQTLzJFOZFUJoIAMM+4o6lKZnnO0uWXE2xbxDA
QJJoQP5D0uLcxAHJaxxTXc0lvQnqAa1+EFouQPZAOo9Gt93kZSSaZgOuLLqVfnaF
QtToFn/JCQtit6vwJiPsNn+83zj94a2QWT72Ddq7gG6CeeOaGJIXHn1Nhhlf1Y2n
m7Zmg4hhHAMzjswOkflOU4NL4adWwzXGe0lnD3NE+t/x6z5avuo22VigCXf+h8dl
d5cPx7LAGRJGswXEM1xj50bAvnc6ZGfoXmgRGFPoBJalN0K8HyxAeNZr4zsl+u7l
ql9nRrDWUZx57snyGrCyn1DPmu3mu2vqHSnIUACsv0BDBaPWCNU3Q/YWtGk/URc=
=fEZn
-----END PGP SIGNATURE-----
Antonio Quartulli (8):
batman-adv: clean up Kconfig
batman-adv: use ETH_ALEN instead of hardcoded numeric constants
batman-adv: convert the tt_crc to network order
batman-adv: remove duplicated line in comment
batman-adv: use ETH_HLEN instead of sizeof(struct ethhdr)
batman-adv: print OGM seq numbers as unsigned int
batman-adv: skip the window protection test when the originator has no neighbours
batman-adv: fix wrong dhcp option list browsing
Eric Dumazet (1):
net: cleanup unsigned to unsigned int
Marek Lindner (15):
batman-adv: encourage batman to take shorter routes by changing the default hop penalty
batman-adv: move ogm initialization into the proper function
batman-adv: refactoring API: find generalized name for bat_ogm_init callback
batman-adv: randomize initial seqno to avoid collision
batman-adv: add iface_disable() callback to routing API
batman-adv: handle routing code initialization properly
batman-adv: refactoring API: find generalized name for bat_ogm_init_primary callback
batman-adv: rename BATMAN_OGM_LEN to BATMAN_OGM_HLEN
batman-adv: mark existing ogm variables as batman iv
batman-adv: introduce is_single_hop_neigh variable to increase readability
batman-adv: introduce packet type handler array for incoming packets
batman-adv: register batman ogm receive function during protocol init
batman-adv: rename last_valid to last_seen
batman-adv: replace HZ calculations with jiffies_to_msecs()
batman-adv: split neigh_new function into generic and batman iv specific parts
Simon Wunderlich (10):
batman-adv: remove old bridge loop avoidance code
batman-adv: add basic bridge loop avoidance code
batman-adv: make bridge loop avoidance switchable
batman-adv: export claim tables through debugfs
batman-adv: allow multiple entries in tt_global_entries
batman-adv: don't let backbone gateways exchange tt entries
batman-adv: add broadcast duplicate check
batman-adv: drop STP over batman
batman-adv: form groups in the bridge loop avoidance
batman-adv: add bridge loop avoidance compile option
Sven Eckelmann (2):
batman-adv: Replace bitarray operations with bitmap
batman-adv: Remove declaration of only locally used functions
-----------------------------------------------------------------------
--
linux integration
10 years, 1 month