forked from torvalds/linux
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
batman-adv: network coding - add the initial infrastructure code
Network coding exploits the 802.11 shared medium to allow multiple packets to be sent in a single transmission. In brief, a relay can XOR two packets, and send the coded packet to two destinations. The receivers can decode one of the original packets by XOR'ing the coded packet with the other original packet. This will lead to increased throughput in topologies where two packets cross one relay. In a simple topology with three nodes, it takes four transmissions without network coding to get one packet from Node A to Node B and one from Node B to Node A: 1. Node A ---- p1 ---> Node R Node B 2. Node A Node R <--- p2 ---- Node B 3. Node A <--- p2 ---- Node R Node B 4. Node A Node R ---- p1 ---> Node B With network coding, the relay only needs one transmission, which saves us one slot of valuable airtime: 1. Node A ---- p1 ---> Node R Node B 2. Node A Node R <--- p2 ---- Node B 3. Node A <- p1 x p2 - Node R - p1 x p2 -> Node B The same principle holds for a topology including five nodes. Here the packets from Node A and Node B are overheard by Node C and Node D, respectively. This allows Node R to send a network coded packet to save one transmission: Node A Node B | \ / | | p1 p2 | | \ / | p1 > Node R < p2 | | | / \ | | p1 x p2 p1 x p2 | v / \ v / \ Node C < > Node D More information is available on the open-mesh.org wiki[1]. This patch adds the initial code to support network coding in batman-adv. It sets up a worker thread to do house keeping and adds a sysfs file to enable/disable network coding. The feature is disabled by default, as it requires a wifi-driver with working promiscuous mode, and also because it adds a small delay at each hop. [1] http://www.open-mesh.org/projects/batman-adv/wiki/Catwoman Signed-off-by: Martin Hundebøll <[email protected]> Signed-off-by: Marek Lindner <[email protected]> Signed-off-by: Antonio Quartulli <[email protected]>
- Loading branch information
Showing
10 changed files
with
184 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -67,6 +67,14 @@ Description: | |
Defines the penalty which will be applied to an | ||
originator message's tq-field on every hop. | ||
|
||
What: /sys/class/net/<mesh_iface>/mesh/network_coding | ||
Date: Nov 2012 | ||
Contact: Martin Hundeboll <[email protected]> | ||
Description: | ||
Controls whether Network Coding (using some magic | ||
to send fewer wifi packets but still the same | ||
content) is enabled or not. | ||
|
||
What: /sys/class/net/<mesh_iface>/mesh/orig_interval | ||
Date: May 2010 | ||
Contact: Marek Lindner <[email protected]> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
/* Copyright (C) 2012-2013 B.A.T.M.A.N. contributors: | ||
* | ||
* Martin Hundebøll, Jeppe Ledet-Pedersen | ||
* | ||
* This program is free software; you can redistribute it and/or | ||
* modify it under the terms of version 2 of the GNU General Public | ||
* License as published by the Free Software Foundation. | ||
* | ||
* This program is distributed in the hope that it will be useful, but | ||
* WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
* General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program; if not, write to the Free Software | ||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | ||
* 02110-1301, USA | ||
*/ | ||
|
||
#include "main.h" | ||
#include "network-coding.h" | ||
|
||
static void batadv_nc_worker(struct work_struct *work); | ||
|
||
/** | ||
* batadv_nc_start_timer - initialise the nc periodic worker | ||
* @bat_priv: the bat priv with all the soft interface information | ||
*/ | ||
static void batadv_nc_start_timer(struct batadv_priv *bat_priv) | ||
{ | ||
queue_delayed_work(batadv_event_workqueue, &bat_priv->nc.work, | ||
msecs_to_jiffies(10)); | ||
} | ||
|
||
/** | ||
* batadv_nc_init - initialise coding hash table and start house keeping | ||
* @bat_priv: the bat priv with all the soft interface information | ||
*/ | ||
int batadv_nc_init(struct batadv_priv *bat_priv) | ||
{ | ||
INIT_DELAYED_WORK(&bat_priv->nc.work, batadv_nc_worker); | ||
batadv_nc_start_timer(bat_priv); | ||
|
||
return 0; | ||
} | ||
|
||
/** | ||
* batadv_nc_init_bat_priv - initialise the nc specific bat_priv variables | ||
* @bat_priv: the bat priv with all the soft interface information | ||
*/ | ||
void batadv_nc_init_bat_priv(struct batadv_priv *bat_priv) | ||
{ | ||
atomic_set(&bat_priv->network_coding, 1); | ||
} | ||
|
||
/** | ||
* batadv_nc_worker - periodic task for house keeping related to network coding | ||
* @work: kernel work struct | ||
*/ | ||
static void batadv_nc_worker(struct work_struct *work) | ||
{ | ||
struct delayed_work *delayed_work; | ||
struct batadv_priv_nc *priv_nc; | ||
struct batadv_priv *bat_priv; | ||
|
||
delayed_work = container_of(work, struct delayed_work, work); | ||
priv_nc = container_of(delayed_work, struct batadv_priv_nc, work); | ||
bat_priv = container_of(priv_nc, struct batadv_priv, nc); | ||
|
||
/* Schedule a new check */ | ||
batadv_nc_start_timer(bat_priv); | ||
} | ||
|
||
/** | ||
* batadv_nc_free - clean up network coding memory | ||
* @bat_priv: the bat priv with all the soft interface information | ||
*/ | ||
void batadv_nc_free(struct batadv_priv *bat_priv) | ||
{ | ||
cancel_delayed_work_sync(&bat_priv->nc.work); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* Copyright (C) 2012-2013 B.A.T.M.A.N. contributors: | ||
* | ||
* Martin Hundebøll, Jeppe Ledet-Pedersen | ||
* | ||
* This program is free software; you can redistribute it and/or | ||
* modify it under the terms of version 2 of the GNU General Public | ||
* License as published by the Free Software Foundation. | ||
* | ||
* This program is distributed in the hope that it will be useful, but | ||
* WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
* General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program; if not, write to the Free Software | ||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | ||
* 02110-1301, USA | ||
*/ | ||
|
||
#ifndef _NET_BATMAN_ADV_NETWORK_CODING_H_ | ||
#define _NET_BATMAN_ADV_NETWORK_CODING_H_ | ||
|
||
#ifdef CONFIG_BATMAN_ADV_NC | ||
|
||
int batadv_nc_init(struct batadv_priv *bat_priv); | ||
void batadv_nc_free(struct batadv_priv *bat_priv); | ||
void batadv_nc_init_bat_priv(struct batadv_priv *bat_priv); | ||
|
||
#else /* ifdef CONFIG_BATMAN_ADV_NC */ | ||
|
||
static inline int batadv_nc_init(struct batadv_priv *bat_priv) | ||
{ | ||
return 0; | ||
} | ||
|
||
static inline void batadv_nc_free(struct batadv_priv *bat_priv) | ||
{ | ||
return; | ||
} | ||
|
||
static inline void batadv_nc_init_bat_priv(struct batadv_priv *bat_priv) | ||
{ | ||
return; | ||
} | ||
|
||
#endif /* ifdef CONFIG_BATMAN_ADV_NC */ | ||
|
||
#endif /* _NET_BATMAN_ADV_NETWORK_CODING_H_ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters