Repository : ssh://git@open-mesh.org/batman-adv
On branch : next
commit 17a6a8c33c602fd9b495f5878895449e62361b6f Merge: 4e1f729 586cf84 Author: Marek Lindner mareklindner@neomailbox.ch Date: Mon Sep 30 23:20:26 2013 +0800
Merge branch 'maint' into next
Conflicts: network-coding.c network-coding.h
17a6a8c33c602fd9b495f5878895449e62361b6f main.c | 5 +++-- network-coding.c | 28 ++++++++++++++++++---------- network-coding.h | 14 ++++++++++---- 3 files changed, 31 insertions(+), 16 deletions(-)
diff --cc main.c index 21c6a01,c8e0671..c51a5e5 --- a/main.c +++ b/main.c @@@ -165,8 -161,10 +166,8 @@@ void batadv_mesh_free(struct net_devic
batadv_purge_outstanding_packets(bat_priv, NULL);
- batadv_vis_quit(bat_priv); - batadv_gw_node_purge(bat_priv); - batadv_nc_free(bat_priv); + batadv_nc_mesh_free(bat_priv); batadv_dat_free(bat_priv); batadv_bla_free(bat_priv);
diff --cc network-coding.c index 173a96e,4ecc0b6..351e199 --- a/network-coding.c +++ b/network-coding.c @@@ -45,63 -59,10 +59,63 @@@ static void batadv_nc_start_timer(struc }
/** + * batadv_nc_tvlv_container_update - update the network coding tvlv container + * after network coding setting change + * @bat_priv: the bat priv with all the soft interface information + */ +static void batadv_nc_tvlv_container_update(struct batadv_priv *bat_priv) +{ + char nc_mode; + + nc_mode = atomic_read(&bat_priv->network_coding); + + switch (nc_mode) { + case 0: + batadv_tvlv_container_unregister(bat_priv, BATADV_TVLV_NC, 1); + break; + case 1: + batadv_tvlv_container_register(bat_priv, BATADV_TVLV_NC, 1, + NULL, 0); + break; + } +} + +/** + * batadv_nc_status_update - update the network coding tvlv container after + * network coding setting change + * @net_dev: the soft interface net device + */ +void batadv_nc_status_update(struct net_device *net_dev) +{ + struct batadv_priv *bat_priv = netdev_priv(net_dev); + batadv_nc_tvlv_container_update(bat_priv); +} + +/** + * batadv_nc_tvlv_ogm_handler_v1 - process incoming nc tvlv container + * @bat_priv: the bat priv with all the soft interface information + * @orig: the orig_node of the ogm + * @flags: flags indicating the tvlv state (see batadv_tvlv_handler_flags) + * @tvlv_value: tvlv buffer containing the gateway data + * @tvlv_value_len: tvlv buffer length + */ +static void batadv_nc_tvlv_ogm_handler_v1(struct batadv_priv *bat_priv, + struct batadv_orig_node *orig, + uint8_t flags, + void *tvlv_value, + uint16_t tvlv_value_len) +{ + if (flags & BATADV_TVLV_HANDLER_OGM_CIFNOTFND) + orig->capabilities &= ~BATADV_ORIG_CAPA_HAS_NC; + else + orig->capabilities |= BATADV_ORIG_CAPA_HAS_NC; +} + +/** - * batadv_nc_init - initialise coding hash table and start house keeping + * batadv_nc_mesh_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) + int batadv_nc_mesh_init(struct batadv_priv *bat_priv) { bat_priv->nc.timestamp_fwd_flush = jiffies; bat_priv->nc.timestamp_sniffed_purge = jiffies; @@@ -1784,14 -1730,11 +1793,13 @@@ free_nc_packet }
/** - * batadv_nc_free - clean up network coding memory + * batadv_nc_mesh_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) + void batadv_nc_mesh_free(struct batadv_priv *bat_priv) { - batadv_recv_handler_unregister(BATADV_CODED); + batadv_tvlv_container_unregister(bat_priv, BATADV_TVLV_NC, 1); + batadv_tvlv_handler_unregister(bat_priv, BATADV_TVLV_NC, 1); cancel_delayed_work_sync(&bat_priv->nc.work);
batadv_nc_purge_paths(bat_priv, bat_priv->nc.coding_hash, NULL); diff --cc network-coding.h index d2f110c,ddfa618..d4fd315 --- a/network-coding.h +++ b/network-coding.h @@@ -22,9 -22,9 +22,10 @@@
#ifdef CONFIG_BATMAN_ADV_NC
+void batadv_nc_status_update(struct net_device *net_dev); - int batadv_nc_init(struct batadv_priv *bat_priv); - void batadv_nc_free(struct batadv_priv *bat_priv); + int batadv_nc_init(void); + int batadv_nc_mesh_init(struct batadv_priv *bat_priv); + void batadv_nc_mesh_free(struct batadv_priv *bat_priv); void batadv_nc_update_nc_node(struct batadv_priv *bat_priv, struct batadv_orig_node *orig_node, struct batadv_orig_node *orig_neigh_node, @@@ -47,11 -47,7 +48,11 @@@ int batadv_nc_init_debugfs(struct batad
#else /* ifdef CONFIG_BATMAN_ADV_NC */
+static inline void batadv_nc_status_update(struct net_device *net_dev) +{ +} + - static inline int batadv_nc_init(struct batadv_priv *bat_priv) + static inline int batadv_nc_init(void) { return 0; }