[B.A.T.M.A.N.] Batman with Ubiquiti SDK
by Mitar
Hi!
Ubiquiti provides OpenWrt based SDK for their firmware. To my
information, it contains some proprietary madwifi-based WiFi drivers
with some older OpenWrt version. My question is how it would be
possible to run Batman on top of their firmware (thus not latest
OpenWrt). As Batman is in kernel, is is enough kernel-backwards
compatible to be able to run also on older (2.6) kernel versions? For
olsrd it is much simpler: you just install olsrd package and this is
it.
Mitar
8 years, 5 months
[B.A.T.M.A.N.] link alternation when radios are not on batman-adv router?
by dan
I have an interesting hardware setup I'd like to explore.
Basically, I would like to take commodity ubiquiti and/or openmesh
hardware and build a mesh with two different node types, some having
just 1 radio and others having multiple radios, a standard node and a
super node.
the standard node is:
a picostation flashed to openwrt running batman-adv and running the
radio in Ad-Hoc mode. Alternately an OM2P flashed to openwrt. This
is the basic client radio
the super node is:
a group of picostations or nanostations, flashed openwrt in adhoc
mode, but acting only as the L2 transport with a router at the center
running batman-adv.
The idea is that the super nodes have multiple radios in multiple
channels and can take advantage of link alternation allowing super
nodes to keep much higher bandwidth between them while the standard
nodes are cheap. The 'router' MIGHT also have a radio for client
access (unifi station flashed to openwrt maybe, or an ALIX board)
The supernode will have more CPU and also be the target of
backhaul/shorthaul links to cut down on hop count. The main router
would also be a batman-adv device, probably an x86 server, and would
be the border router for the mesh.
some questions,
I know that the supernodes will have higher throughput capabilities
due to dual mesh radios, but how will batman-adv know this or how
would I tell it? Is the internal mechanism for determining the best
path going to take this into account? Is there a way to identify a
supernode as being a better path above and beyond the automatic
batman-adv mechanisms?
Is having separate radios connected to a batman-adv router going to
behave how I presume? That multiple node2node connections will be
identified and the links be alternated when appropriate?
If the supernodes have 2 mesh radios, 1 in 5Ghz and 1 in 2.4Ghz, then
the standard nodes will only be able to connect to the 2.4Ghz channel
which might make it inappropriate to do link alternating on these two
links because of the shared traffic. Should batman-adv automatically
stop alternating the tx/rx on these links when one of the channels
starts to get saturated?
some other info:
the supernodes may have a link directly to the main distribution
point, but may also be linked just to another supernode and not to the
main distribution point, or possibly both.
the supernodes are likely to have more than 2 mesh radios as some of
these could be direction antennas. A supernode might have 3x 2.4Ghz
radios for mesh, 2x 5Ghz radios for mesh, and a 2.4Ghz radio for
non-mesh clients. These would most likely all be connected to a
switch port and only be on a single ethernet interface as far as
batman-adv is concerned.
8 years, 6 months
[B.A.T.M.A.N.] pull request: batman-adv 2012-04-29
by Antonio Quartulli
Hello David,
this is the new version of my last pull request (issued on 2012-04-25).
This patchset is intended for net-next/linux-3.5.
Since last series I only removed the biggest_unsigned_int() macro.
Let me know if there is any other problem.
Thank you,
Antonio
===============================================================
The following changes since commit 7a2a66a0ac1cf93d30869c4ecbfc71a2fda19397:
Add linux-next specific files for 20120423 (2012-04-23 16:58:43 +1000)
are available in the git repository at:
git://git.open-mesh.org/linux-merge.git tags/batman-adv-for-davem
for you to fetch changes up to 3ad345e2521ef41500cc0890a717656b975c4321:
batman-adv: split neigh_new function into generic and batman iv specific parts (2012-04-29 10:50:10 +0200)
----------------------------------------------------------------
Included changes:
* a new feature has been introduced: D.A.T. (Distributed ARP Table). It is a
mechanism based on DHT theory that creates a distributed (mesh network wide)
ARP cache in order to speed up ARP resolutions in sparse wireless mesh
networks.
* in order to satisfy DAT requirements a new unicast packet type, namely
UNICAST_4ADDR, has been introduced. Backward compatibility has been kept: not
updated nodes will simply drop the packet and ignore DAT mechanism.
* minor fixes and cleanups
* minor routing protocol API cleanups
----------------------------------------------------------------
Antonio Quartulli (9):
batman-adv: add UNICAST_4ADDR packet type
batman-adv: add a new log level for DAT debugging
batman-adv: add biggest_unsigned_int(x) macro
batman-adv: Distributed ARP Table - create DHT helper functions
batman-adv: Distributed ARP Table - add ARP parsing functions
batman-adv: Distributed ARP Table - add snooping functions for ARP messages
batman-adv: Distributed ARP Table - increase default soft_iface ARP table timeout
batman-adv: Distributed ARP Table - add compile option
batman-adv: fix wrong dhcp option list browsing
Marek Lindner (6):
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
Documentation/networking/batman-adv.txt | 3 +-
net/batman-adv/Kconfig | 10 +
net/batman-adv/Makefile | 1 +
net/batman-adv/bat_debugfs.c | 4 +-
net/batman-adv/bat_iv_ogm.c | 95 +++--
net/batman-adv/bat_sysfs.c | 2 +-
net/batman-adv/distributed-arp-table.c | 605 +++++++++++++++++++++++++++++++
net/batman-adv/distributed-arp-table.h | 140 +++++++
net/batman-adv/gateway_client.c | 6 +-
net/batman-adv/hard-interface.c | 116 +-----
net/batman-adv/main.c | 124 ++++++-
net/batman-adv/main.h | 21 +-
net/batman-adv/originator.c | 52 +--
net/batman-adv/originator.h | 6 +-
net/batman-adv/packet.h | 30 +-
net/batman-adv/routing.c | 30 +-
net/batman-adv/routing.h | 4 +-
net/batman-adv/send.c | 6 +-
net/batman-adv/soft-interface.c | 17 +-
net/batman-adv/types.h | 33 +-
net/batman-adv/unicast.c | 102 +++++-
net/batman-adv/unicast.h | 21 +-
22 files changed, 1202 insertions(+), 226 deletions(-)
create mode 100644 net/batman-adv/distributed-arp-table.c
create mode 100644 net/batman-adv/distributed-arp-table.h
8 years, 8 months
[B.A.T.M.A.N.] collaboration-group on batman-adv installation & application
by 3zl Trizonelabs
I would like to organize a kind of collaboration-site on all practical
aspects of batman-adv installation.
It could be a platform to discuss, interchange know how dealing with
all aspects of batman-adv mesh application
As i did switch from AWDS-L2 to batman-adv, i am about to start
gathering some samples of code & information i thought would be viable
to help getting a batman-mesh running.
Anyone interested please respond to discuss how this might be setup.
(example: www.teamlab.com )
In case there exists something like this please notify me.
regards
3zl
8 years, 8 months
[B.A.T.M.A.N.] [RFC 1/2] batman-adv: Free local translation table on error in tt_init
by Sven Eckelmann
Signed-off-by: Sven Eckelmann <sven(a)narfation.org>
---
translation-table.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/translation-table.c b/translation-table.c
index 88c62f1..c3b7773 100644
--- a/translation-table.c
+++ b/translation-table.c
@@ -1776,8 +1776,10 @@ int tt_init(struct bat_priv *bat_priv)
if (!tt_local_init(bat_priv))
return 0;
- if (!tt_global_init(bat_priv))
+ if (!tt_global_init(bat_priv)) {
+ tt_local_table_free(bat_priv);
return 0;
+ }
tt_start_timer(bat_priv);
--
1.7.10
8 years, 8 months
[B.A.T.M.A.N.] pull request: batman-adv 2012-04-25
by Antonio Quartulli
I'd like to propose the following changes for net-next/linux-3.5.
The first 8 patches introduce a new feature called D.A.T. (Distributed ARP
Table) which is the resulting implementation of Antonio Quartulli's GSOC 2011
Project[0]. This feature aims to improve reliability of ARP resolutions in
sparse wireless mesh networks by creating either a local and a
network-wide-distributed ARP cache. Major details can be found on its
wikipage[1].
It is an optional feature and it is possible to choose whether to compile it
or not by using the proper Kconfig option (=n by default). We are evaluating the
possibility of introducing a runtime switch to turn the behaviour on an off
without recompiling the module (like for the bridge loop avoidance).
Patch 1 also introduces a new packet type, but backward compatibility is
preserved.
Patch 9 fixes a bug in the "gw propagation" feature introduced so far.
Patch 11 and 12 are yet other improvements for the new
routing-protocol-API.
The others are minor fixes and cleanups.
Thank you very much,
Antonio
[0] http://www.google-melange.com/gsoc/project/google/gsoc2011/ordex/4001
[1] http://www.open-mesh.org/wiki/batman-adv/DistributedArpTable
The following changes since commit 7a2a66a0ac1cf93d30869c4ecbfc71a2fda19397:
Add linux-next specific files for 20120423 (2012-04-23 16:58:43 +1000)
are available in the git repository at:
git://git.open-mesh.org/linux-merge.git tags/batman-adv-for-davem
for you to fetch changes up to cc01b7a1f16291cc48fa6d261aa952d45604f10c:
batman-adv: split neigh_new function into generic and batman iv specific parts (2012-04-24 10:11:31 +0200)
----------------------------------------------------------------
Included changes:
* a new feature has been introduced: D.A.T. (Distributed ARP Table). It is a
mechanism based on DHT theory that creates a distributed (mesh network wide)
ARP cache in order to speed up ARP resolutions in sparse wireless mesh
networks.
* in order to satisfy DAT requirements a new unicast packet type, namely
UNICAST_4ADDR, has been introduced. Backward compatibility has been kept: not
updated nodes will simply drop the packet and ignore DAT mechanism.
* minor fixes and cleanups
* minor routing protocol API cleanups
----------------------------------------------------------------
Antonio Quartulli (9):
batman-adv: add UNICAST_4ADDR packet type
batman-adv: add a new log level for DAT debugging
batman-adv: add biggest_unsigned_int(x) macro
batman-adv: Distributed ARP Table - create DHT helper functions
batman-adv: Distributed ARP Table - add ARP parsing functions
batman-adv: Distributed ARP Table - add snooping functions for ARP messages
batman-adv: Distributed ARP Table - increase default soft_iface ARP table timeout
batman-adv: Distributed ARP Table - add compile option
batman-adv: fix wrong dhcp option list browsing
Marek Lindner (6):
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
Documentation/networking/batman-adv.txt | 3 +-
net/batman-adv/Kconfig | 10 +
net/batman-adv/Makefile | 1 +
net/batman-adv/bat_debugfs.c | 4 +-
net/batman-adv/bat_iv_ogm.c | 95 +++--
net/batman-adv/bat_sysfs.c | 2 +-
net/batman-adv/distributed-arp-table.c | 605 +++++++++++++++++++++++++++++++
net/batman-adv/distributed-arp-table.h | 140 +++++++
net/batman-adv/gateway_client.c | 6 +-
net/batman-adv/hard-interface.c | 116 +-----
net/batman-adv/main.c | 124 ++++++-
net/batman-adv/main.h | 24 +-
net/batman-adv/originator.c | 52 +--
net/batman-adv/originator.h | 6 +-
net/batman-adv/packet.h | 30 +-
net/batman-adv/routing.c | 30 +-
net/batman-adv/routing.h | 4 +-
net/batman-adv/send.c | 6 +-
net/batman-adv/soft-interface.c | 17 +-
net/batman-adv/types.h | 33 +-
net/batman-adv/unicast.c | 102 +++++-
net/batman-adv/unicast.h | 21 +-
22 files changed, 1205 insertions(+), 226 deletions(-)
create mode 100644 net/batman-adv/distributed-arp-table.c
create mode 100644 net/batman-adv/distributed-arp-table.h
8 years, 8 months
[B.A.T.M.A.N.] [RFC] batman-adv: turn tt commit code into routing protocol agnostic API
by Marek Lindner
Prior to this patch the translation table code made assumptions about how
the routing protocol works and where its buffers are stored (to directly
modify them).
Each protocol now calls the tt code with the relevant pointers, thereby
abstracting the code.
Signed-off-by: Marek Lindner <lindner_marek(a)yahoo.de>
---
bat_iv_ogm.c | 21 +++++++---
send.c | 74 +----------------------------------
translation-table.c | 110 +++++++++++++++++++++++++++++++++++++++++++++------
translation-table.h | 6 +-
types.h | 3 +-
5 files changed, 117 insertions(+), 97 deletions(-)
diff --git a/bat_iv_ogm.c b/bat_iv_ogm.c
index 2b48b82..a833640 100644
--- a/bat_iv_ogm.c
+++ b/bat_iv_ogm.c
@@ -562,13 +562,12 @@ static void bat_iv_ogm_forward(struct orig_node *orig_node,
if_incoming, 0, bat_iv_ogm_fwd_send_time());
}
-static void bat_iv_ogm_schedule(struct hard_iface *hard_iface,
- int tt_num_changes)
+static void bat_iv_ogm_schedule(struct hard_iface *hard_iface)
{
struct bat_priv *bat_priv = netdev_priv(hard_iface->soft_iface);
struct batman_ogm_packet *batman_ogm_packet;
struct hard_iface *primary_if;
- int vis_server;
+ int vis_server, tt_num_changes = 0;
vis_server = atomic_read(&bat_priv->vis_mode);
primary_if = primary_if_get_selected(bat_priv);
@@ -579,10 +578,7 @@ static void bat_iv_ogm_schedule(struct hard_iface *hard_iface,
batman_ogm_packet->seqno =
htonl((uint32_t)atomic_read(&hard_iface->seqno));
- batman_ogm_packet->ttvn = atomic_read(&bat_priv->ttvn);
batman_ogm_packet->tt_crc = htons(bat_priv->tt_crc);
- if (tt_num_changes >= 0)
- batman_ogm_packet->tt_num_changes = tt_num_changes;
if (vis_server == VIS_TYPE_SERVER_SYNC)
batman_ogm_packet->flags |= VIS_SERVER;
@@ -598,6 +594,19 @@ static void bat_iv_ogm_schedule(struct hard_iface *hard_iface,
atomic_inc(&hard_iface->seqno);
+ if (hard_iface == primary_if)
+ tt_num_changes = tt_append_changes(bat_priv,
+ &hard_iface->packet_buff,
+ &hard_iface->packet_len,
+ BATMAN_OGM_HLEN);
+
+ if (tt_num_changes > 0)
+ batman_ogm_packet->tt_num_changes = tt_num_changes;
+ else
+ batman_ogm_packet->tt_num_changes = 0;
+
+ batman_ogm_packet->ttvn = atomic_read(&bat_priv->ttvn);
+
slide_own_bcast_window(hard_iface);
bat_iv_ogm_queue_add(bat_priv, hard_iface->packet_buff,
hard_iface->packet_len, hard_iface, 1,
diff --git a/send.c b/send.c
index cebc14a..836b70d 100644
--- a/send.c
+++ b/send.c
@@ -78,62 +78,9 @@ send_skb_err:
return NET_XMIT_DROP;
}
-static void realloc_packet_buffer(struct hard_iface *hard_iface,
- int new_len)
-{
- unsigned char *new_buff;
-
- new_buff = kmalloc(new_len, GFP_ATOMIC);
-
- /* keep old buffer if kmalloc should fail */
- if (new_buff) {
- memcpy(new_buff, hard_iface->packet_buff,
- BATMAN_OGM_HLEN);
-
- kfree(hard_iface->packet_buff);
- hard_iface->packet_buff = new_buff;
- hard_iface->packet_len = new_len;
- }
-}
-
-/* when calling this function (hard_iface == primary_if) has to be true */
-static int prepare_packet_buffer(struct bat_priv *bat_priv,
- struct hard_iface *hard_iface)
-{
- int new_len;
-
- new_len = BATMAN_OGM_HLEN +
- tt_len((uint8_t)atomic_read(&bat_priv->tt_local_changes));
-
- /* if we have too many changes for one packet don't send any
- * and wait for the tt table request which will be fragmented */
- if (new_len > hard_iface->soft_iface->mtu)
- new_len = BATMAN_OGM_HLEN;
-
- realloc_packet_buffer(hard_iface, new_len);
-
- bat_priv->tt_crc = tt_local_crc(bat_priv);
-
- /* reset the sending counter */
- atomic_set(&bat_priv->tt_ogm_append_cnt, TT_OGM_APPEND_MAX);
-
- return tt_changes_fill_buffer(bat_priv,
- hard_iface->packet_buff + BATMAN_OGM_HLEN,
- hard_iface->packet_len - BATMAN_OGM_HLEN);
-}
-
-static int reset_packet_buffer(struct bat_priv *bat_priv,
- struct hard_iface *hard_iface)
-{
- realloc_packet_buffer(hard_iface, BATMAN_OGM_HLEN);
- return 0;
-}
-
void schedule_bat_ogm(struct hard_iface *hard_iface)
{
struct bat_priv *bat_priv = netdev_priv(hard_iface->soft_iface);
- struct hard_iface *primary_if;
- int tt_num_changes = -1;
if ((hard_iface->if_status == IF_NOT_IN_USE) ||
(hard_iface->if_status == IF_TO_BE_REMOVED))
@@ -149,26 +96,7 @@ void schedule_bat_ogm(struct hard_iface *hard_iface)
if (hard_iface->if_status == IF_TO_BE_ACTIVATED)
hard_iface->if_status = IF_ACTIVE;
- primary_if = primary_if_get_selected(bat_priv);
-
- if (hard_iface == primary_if) {
- /* if at least one change happened */
- if (atomic_read(&bat_priv->tt_local_changes) > 0) {
- tt_commit_changes(bat_priv);
- tt_num_changes = prepare_packet_buffer(bat_priv,
- hard_iface);
- }
-
- /* if the changes have been sent often enough */
- if (!atomic_dec_not_zero(&bat_priv->tt_ogm_append_cnt))
- tt_num_changes = reset_packet_buffer(bat_priv,
- hard_iface);
- }
-
- if (primary_if)
- hardif_free_ref(primary_if);
-
- bat_priv->bat_algo_ops->bat_ogm_schedule(hard_iface, tt_num_changes);
+ bat_priv->bat_algo_ops->bat_ogm_schedule(hard_iface);
}
static void forw_packet_free(struct forw_packet *forw_packet)
diff --git a/translation-table.c b/translation-table.c
index 88c62f1..b032087 100644
--- a/translation-table.c
+++ b/translation-table.c
@@ -275,14 +275,63 @@ out:
tt_global_entry_free_ref(tt_global_entry);
}
-int tt_changes_fill_buffer(struct bat_priv *bat_priv,
- unsigned char *buff, int buff_len)
+static void tt_realloc_packet_buff(unsigned char **packet_buff,
+ int *packet_buff_len, int min_packet_len,
+ int new_packet_len)
+{
+ unsigned char *new_buff;
+
+ new_buff = kmalloc(new_packet_len, GFP_ATOMIC);
+
+ /* keep old buffer if kmalloc should fail */
+ if (new_buff) {
+ memcpy(new_buff, *packet_buff, min_packet_len);
+ kfree(*packet_buff);
+ *packet_buff = new_buff;
+ *packet_buff_len = new_packet_len;
+ }
+}
+
+static void tt_prepare_packet_buff(struct bat_priv *bat_priv,
+ unsigned char **packet_buff,
+ int *packet_buff_len, int min_packet_len)
+{
+ struct hard_iface *primary_if;
+ int req_len;
+
+ primary_if = primary_if_get_selected(bat_priv);
+
+ req_len = min_packet_len;
+ req_len += tt_len((uint8_t)atomic_read(&bat_priv->tt_local_changes));
+
+ /* if we have too many changes for one packet don't send any
+ * and wait for the tt table request which will be fragmented */
+ if ((!primary_if) || (req_len > primary_if->soft_iface->mtu))
+ req_len = min_packet_len;
+
+ tt_realloc_packet_buff(packet_buff, packet_buff_len,
+ min_packet_len, req_len);
+
+ if (primary_if)
+ hardif_free_ref(primary_if);
+}
+
+static int tt_changes_fill_buff(struct bat_priv *bat_priv,
+ unsigned char **packet_buff,
+ int *packet_buff_len, int min_packet_len)
{
- int count = 0, tot_changes = 0;
struct tt_change_node *entry, *safe;
+ int count = 0, tot_changes = 0, new_len;
+ unsigned char *tt_buff;
+
+ tt_prepare_packet_buff(bat_priv, packet_buff,
+ packet_buff_len, min_packet_len);
- if (buff_len > 0)
- tot_changes = buff_len / tt_len(1);
+ new_len = *packet_buff_len - min_packet_len;
+ tt_buff = *packet_buff + min_packet_len;
+
+ if (new_len > 0)
+ tot_changes = new_len / tt_len(1);
spin_lock_bh(&bat_priv->tt_changes_list_lock);
atomic_set(&bat_priv->tt_local_changes, 0);
@@ -290,7 +339,7 @@ int tt_changes_fill_buffer(struct bat_priv *bat_priv,
list_for_each_entry_safe(entry, safe, &bat_priv->tt_changes_list,
list) {
if (count < tot_changes) {
- memcpy(buff + tt_len(count),
+ memcpy(tt_buff + tt_len(count),
&entry->change, sizeof(struct tt_change));
count++;
}
@@ -306,15 +355,15 @@ int tt_changes_fill_buffer(struct bat_priv *bat_priv,
bat_priv->tt_buff = NULL;
/* We check whether this new OGM has no changes due to size
* problems */
- if (buff_len > 0) {
+ if (new_len > 0) {
/**
* if kmalloc() fails we will reply with the full table
* instead of providing the diff
*/
- bat_priv->tt_buff = kmalloc(buff_len, GFP_ATOMIC);
+ bat_priv->tt_buff = kmalloc(new_len, GFP_ATOMIC);
if (bat_priv->tt_buff) {
- memcpy(bat_priv->tt_buff, buff, buff_len);
- bat_priv->tt_buff_len = buff_len;
+ memcpy(bat_priv->tt_buff, tt_buff, new_len);
+ bat_priv->tt_buff_len = new_len;
}
}
spin_unlock_bh(&bat_priv->tt_buff_lock);
@@ -2019,20 +2068,55 @@ static void tt_local_purge_pending_clients(struct bat_priv *bat_priv)
}
-void tt_commit_changes(struct bat_priv *bat_priv)
+static int tt_commit_changes(struct bat_priv *bat_priv,
+ unsigned char **packet_buff, int *packet_buff_len,
+ int packet_min_len)
{
- uint16_t changed_num = tt_set_flags(bat_priv->tt_local_hash,
- TT_CLIENT_NEW, false);
+ uint16_t changed_num = 0;
+
+ if (atomic_read(&bat_priv->tt_local_changes) < 1)
+ return 0;
+
+ changed_num = tt_set_flags(bat_priv->tt_local_hash,
+ TT_CLIENT_NEW, false);
+
/* all the reset entries have now to be effectively counted as local
* entries */
atomic_add(changed_num, &bat_priv->num_local_tt);
tt_local_purge_pending_clients(bat_priv);
+ bat_priv->tt_crc = tt_local_crc(bat_priv);
/* Increment the TTVN only once per OGM interval */
atomic_inc(&bat_priv->ttvn);
bat_dbg(DBG_TT, bat_priv, "Local changes committed, updating to ttvn %u\n",
(uint8_t)atomic_read(&bat_priv->ttvn));
bat_priv->tt_poss_change = false;
+
+ /* reset the sending counter */
+ atomic_set(&bat_priv->tt_ogm_append_cnt, TT_OGM_APPEND_MAX);
+
+ return tt_changes_fill_buff(bat_priv, packet_buff,
+ packet_buff_len, packet_min_len);
+}
+
+/* when calling this function (hard_iface == primary_if) has to be true */
+int tt_append_changes(struct bat_priv *bat_priv,
+ unsigned char **packet_buff, int *packet_buff_len,
+ int packet_min_len)
+{
+ int tt_num_changes;
+
+ /* if at least one change happened */
+ tt_num_changes = tt_commit_changes(bat_priv, packet_buff,
+ packet_buff_len, packet_min_len);
+
+ /* if the changes have been sent often enough */
+ if ((tt_num_changes == 0) &&
+ (!atomic_dec_not_zero(&bat_priv->tt_ogm_append_cnt)))
+ tt_realloc_packet_buff(packet_buff, packet_buff_len,
+ packet_min_len, packet_min_len);
+
+ return tt_num_changes;
}
bool is_ap_isolated(struct bat_priv *bat_priv, uint8_t *src, uint8_t *dst)
diff --git a/translation-table.h b/translation-table.h
index c43374d..58d9aae 100644
--- a/translation-table.h
+++ b/translation-table.h
@@ -23,8 +23,6 @@
#define _NET_BATMAN_ADV_TRANSLATION_TABLE_H_
int tt_len(int changes_num);
-int tt_changes_fill_buffer(struct bat_priv *bat_priv,
- unsigned char *buff, int buff_len);
int tt_init(struct bat_priv *bat_priv);
void tt_local_add(struct net_device *soft_iface, const uint8_t *addr,
int ifindex);
@@ -48,11 +46,13 @@ bool send_tt_response(struct bat_priv *bat_priv,
bool is_my_client(struct bat_priv *bat_priv, const uint8_t *addr);
void handle_tt_response(struct bat_priv *bat_priv,
struct tt_query_packet *tt_response);
-void tt_commit_changes(struct bat_priv *bat_priv);
bool is_ap_isolated(struct bat_priv *bat_priv, uint8_t *src, uint8_t *dst);
void tt_update_orig(struct bat_priv *bat_priv, struct orig_node *orig_node,
const unsigned char *tt_buff, uint8_t tt_num_changes,
uint8_t ttvn, uint16_t tt_crc);
+int tt_append_changes(struct bat_priv *bat_priv,
+ unsigned char **packet_buff, int *packet_buff_len,
+ int packet_min_len);
bool tt_global_client_is_roaming(struct bat_priv *bat_priv, uint8_t *addr);
diff --git a/types.h b/types.h
index 2944f77..9bde13d 100644
--- a/types.h
+++ b/types.h
@@ -427,8 +427,7 @@ struct bat_algo_ops {
/* called when primary interface is selected / changed */
void (*bat_primary_iface_set)(struct hard_iface *hard_iface);
/* prepare a new outgoing OGM for the send queue */
- void (*bat_ogm_schedule)(struct hard_iface *hard_iface,
- int tt_num_changes);
+ void (*bat_ogm_schedule)(struct hard_iface *hard_iface);
/* send scheduled OGM */
void (*bat_ogm_emit)(struct forw_packet *forw_packet);
};
--
1.7.9.1
8 years, 8 months
[B.A.T.M.A.N.] [PATCH] batman-adv: remove biggest_unsigned_int() macro
by Antonio Quartulli
As suggested by David S. Miller, this macro is not very useful. So we can remove
it and use its expanded version instead.
Signed-off-by: Antonio Quartulli <ordex(a)autistici.org>
---
This patch should be committed into next because it has to be sent to David S.
Miller within the next pull request.
Thank you
distributed-arp-table.h | 2 +-
main.h | 3 ---
2 files changed, 1 insertion(+), 4 deletions(-)
diff --git a/distributed-arp-table.h b/distributed-arp-table.h
index 5e23577..6c0acde 100644
--- a/distributed-arp-table.h
+++ b/distributed-arp-table.h
@@ -29,7 +29,7 @@
#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))
diff --git a/main.h b/main.h
index 97d0258..426a0d5 100644
--- a/main.h
+++ b/main.h
@@ -241,9 +241,6 @@ static inline bool has_timed_out(unsigned long timestamp, unsigned int timeout)
/* 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
--
1.7.9.4
8 years, 8 months
[B.A.T.M.A.N.] [PATCH] batman-adv: Define attribute __percpu for < 2.6.33
by Martin Hundebøll
Signed-off-by: Martin Hundebøll <martin(a)hundeboll.net>
---
compat.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/compat.h b/compat.h
index 2dc41b1..33c52d3 100644
--- a/compat.h
+++ b/compat.h
@@ -59,6 +59,7 @@
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 33)
#define __always_unused __attribute__((unused))
+#define __percpu
#define skb_iif iif
--
1.7.10
8 years, 8 months