summaryrefslogtreecommitdiffstats
path: root/net/batman-adv/routing.c
diff options
context:
space:
mode:
authorMartin Hundebøll <martin@hundeboll.net>2013-01-25 05:12:40 -0500
committerAntonio Quartulli <ordex@autistici.org>2013-03-13 17:53:49 -0400
commit953324776d6d23eb81f5b825870027b9c069db29 (patch)
treeca6a07caecd098623031cffcf8a2dd80a4d1a4e6 /net/batman-adv/routing.c
parentd56b1705e28c196312607bc8bdde0e91879c20b6 (diff)
batman-adv: network coding - buffer unicast packets before forward
Two be able to network code two packets, one packet must be buffered until the next is available. This is done in a "coding buffer", which is essentially a hash table with lists of packets. Each entry in the hash table corresponds to a specific src-dst pair, which has a linked list of packets that are buffered. This patch adds skbs to the buffer just before forwarding them. The buffer is traversed every 10 ms, where timed skbs are removed from the buffer and transmitted. To allow experiments with the network coding scheme, the timeout is tunable through a file in debugfs. Signed-off-by: Martin Hundebøll <martin@hundeboll.net> Signed-off-by: Marek Lindner <lindner_marek@yahoo.de> Signed-off-by: Antonio Quartulli <ordex@autistici.org>
Diffstat (limited to 'net/batman-adv/routing.c')
-rw-r--r--net/batman-adv/routing.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/net/batman-adv/routing.c b/net/batman-adv/routing.c
index 322c97ac10c7..44fda7c6171e 100644
--- a/net/batman-adv/routing.c
+++ b/net/batman-adv/routing.c
@@ -29,6 +29,7 @@
29#include "unicast.h" 29#include "unicast.h"
30#include "bridge_loop_avoidance.h" 30#include "bridge_loop_avoidance.h"
31#include "distributed-arp-table.h" 31#include "distributed-arp-table.h"
32#include "network-coding.h"
32 33
33static int batadv_route_unicast_packet(struct sk_buff *skb, 34static int batadv_route_unicast_packet(struct sk_buff *skb,
34 struct batadv_hard_iface *recv_if); 35 struct batadv_hard_iface *recv_if);
@@ -860,14 +861,17 @@ static int batadv_route_unicast_packet(struct sk_buff *skb,
860 /* decrement ttl */ 861 /* decrement ttl */
861 unicast_packet->header.ttl--; 862 unicast_packet->header.ttl--;
862 863
863 /* Update stats counter */ 864 /* network code packet if possible */
864 batadv_inc_counter(bat_priv, BATADV_CNT_FORWARD); 865 if (batadv_nc_skb_forward(skb, neigh_node, ethhdr)) {
865 batadv_add_counter(bat_priv, BATADV_CNT_FORWARD_BYTES,
866 skb->len + ETH_HLEN);
867
868 /* route it */
869 if (batadv_send_skb_to_orig(skb, orig_node, recv_if))
870 ret = NET_RX_SUCCESS; 866 ret = NET_RX_SUCCESS;
867 } else if (batadv_send_skb_to_orig(skb, orig_node, recv_if)) {
868 ret = NET_RX_SUCCESS;
869
870 /* Update stats counter */
871 batadv_inc_counter(bat_priv, BATADV_CNT_FORWARD);
872 batadv_add_counter(bat_priv, BATADV_CNT_FORWARD_BYTES,
873 skb->len + ETH_HLEN);
874 }
871 875
872out: 876out:
873 if (neigh_node) 877 if (neigh_node)