Skip to content

Commit d56b170

Browse files
hundebollAntonio Quartulli
authored andcommitted
batman-adv: network coding - detect coding nodes and remove these after timeout
To use network coding efficiently, a relay must know when neighbor nodes are likely to have enough information to be able to decode a network coded packet. This is detected by using OGMs from batman-adv to discover when one neighbor is in range of another neighbor. The relay check the TLL to detect when an OGM is forwarded from one neighbor by another neighbor, and thereby knows that the two neighbors are in range and thus overhear packets sent by each other. This information is saved in the orig_node struct to be used when searching for coding opportunities. Two lists are added to the orig_node struct: One for neighbors that can hear the orig_node (outgoing nc_nodes) and one for neighbors that the orig_node can hear (incoming nc_nodes). Information about nc_nodes is kept for 10 seconds and is available through debugfs in batman_adv/nc_nodes to use when debugging network coding. Signed-off-by: Martin Hundebøll <[email protected]> Signed-off-by: Marek Lindner <[email protected]> Signed-off-by: Antonio Quartulli <[email protected]>
1 parent d353d8d commit d56b170

File tree

7 files changed

+524
-0
lines changed

7 files changed

+524
-0
lines changed

net/batman-adv/bat_iv_ogm.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#include "hard-interface.h"
2828
#include "send.h"
2929
#include "bat_algo.h"
30+
#include "network-coding.h"
3031

3132
static struct batadv_neigh_node *
3233
batadv_iv_ogm_neigh_new(struct batadv_hard_iface *hard_iface,
@@ -1185,6 +1186,10 @@ static void batadv_iv_ogm_process(const struct ethhdr *ethhdr,
11851186
if (!orig_neigh_node)
11861187
goto out;
11871188

1189+
/* Update nc_nodes of the originator */
1190+
batadv_nc_update_nc_node(bat_priv, orig_node, orig_neigh_node,
1191+
batadv_ogm_packet, is_single_hop_neigh);
1192+
11881193
orig_neigh_router = batadv_orig_node_get_router(orig_neigh_node);
11891194

11901195
/* drop packet if sender is not a direct neighbor and if we

net/batman-adv/debugfs.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
#include "icmp_socket.h"
3333
#include "bridge_loop_avoidance.h"
3434
#include "distributed-arp-table.h"
35+
#include "network-coding.h"
3536

3637
static struct dentry *batadv_debugfs;
3738

@@ -310,6 +311,14 @@ struct batadv_debuginfo {
310311
const struct file_operations fops;
311312
};
312313

314+
#ifdef CONFIG_BATMAN_ADV_NC
315+
static int batadv_nc_nodes_open(struct inode *inode, struct file *file)
316+
{
317+
struct net_device *net_dev = (struct net_device *)inode->i_private;
318+
return single_open(file, batadv_nc_nodes_seq_print_text, net_dev);
319+
}
320+
#endif
321+
313322
#define BATADV_DEBUGINFO(_name, _mode, _open) \
314323
struct batadv_debuginfo batadv_debuginfo_##_name = { \
315324
.attr = { .name = __stringify(_name), \
@@ -348,6 +357,9 @@ static BATADV_DEBUGINFO(dat_cache, S_IRUGO, batadv_dat_cache_open);
348357
static BATADV_DEBUGINFO(transtable_local, S_IRUGO,
349358
batadv_transtable_local_open);
350359
static BATADV_DEBUGINFO(vis_data, S_IRUGO, batadv_vis_data_open);
360+
#ifdef CONFIG_BATMAN_ADV_NC
361+
static BATADV_DEBUGINFO(nc_nodes, S_IRUGO, batadv_nc_nodes_open);
362+
#endif
351363

352364
static struct batadv_debuginfo *batadv_mesh_debuginfos[] = {
353365
&batadv_debuginfo_originators,
@@ -362,6 +374,9 @@ static struct batadv_debuginfo *batadv_mesh_debuginfos[] = {
362374
#endif
363375
&batadv_debuginfo_transtable_local,
364376
&batadv_debuginfo_vis_data,
377+
#ifdef CONFIG_BATMAN_ADV_NC
378+
&batadv_debuginfo_nc_nodes,
379+
#endif
365380
NULL,
366381
};
367382

@@ -431,6 +446,9 @@ int batadv_debugfs_add_meshif(struct net_device *dev)
431446
}
432447
}
433448

449+
if (batadv_nc_init_debugfs(bat_priv) < 0)
450+
goto rem_attr;
451+
434452
return 0;
435453
rem_attr:
436454
debugfs_remove_recursive(bat_priv->debug_dir);

net/batman-adv/main.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,8 @@
105105
#define BATADV_RESET_PROTECTION_MS 30000
106106
#define BATADV_EXPECTED_SEQNO_RANGE 65536
107107

108+
#define BATADV_NC_NODE_TIMEOUT 10000 /* Milliseconds */
109+
108110
enum batadv_mesh_state {
109111
BATADV_MESH_INACTIVE,
110112
BATADV_MESH_ACTIVE,

0 commit comments

Comments
 (0)