Author: marek Date: 2009-10-25 00:13:47 +0000 (Sun, 25 Oct 2009) New Revision: 1455
Modified: trunk/batman-adv-kernelland/hard-interface.c trunk/batman-adv-kernelland/main.c trunk/batman-adv-kernelland/main.h trunk/batman-adv-kernelland/send.c Log: [batman-adv] Start to send originator messages when interface gets active
The module gets in a inactive state when all interfaces are down. This stops the sending of new packets. When a interface gets activated again it must reactivate the module and then start the sending of new originator messages.
Signed-off-by: Sven Eckelmann sven.eckelmann@gmx.de Signed-off-by: Marek Lindner lindner_marek@yahoo.de
Modified: trunk/batman-adv-kernelland/hard-interface.c =================================================================== --- trunk/batman-adv-kernelland/hard-interface.c 2009-10-25 00:13:44 UTC (rev 1454) +++ trunk/batman-adv-kernelland/hard-interface.c 2009-10-25 00:13:47 UTC (rev 1455) @@ -425,6 +425,10 @@ break; case NETDEV_UP: hardif_activate_interface(batman_if); + if ((atomic_read(&module_state) == MODULE_INACTIVE) && + (hardif_get_active_if_num() > 0)) { + activate_module(); + } break; /* NETDEV_CHANGEADDR - mac address change - what are we doing here ? */ default:
Modified: trunk/batman-adv-kernelland/main.c =================================================================== --- trunk/batman-adv-kernelland/main.c 2009-10-25 00:13:44 UTC (rev 1454) +++ trunk/batman-adv-kernelland/main.c 2009-10-25 00:13:47 UTC (rev 1455) @@ -173,7 +173,7 @@ /* shuts down the whole module.*/ void shutdown_module(void) { - atomic_set(&module_state, MODULE_INACTIVE); + atomic_set(&module_state, MODULE_DEACTIVATING);
purge_outstanding_packets(); flush_workqueue(bat_event_workqueue); @@ -199,6 +199,7 @@
hardif_remove_interfaces(); synchronize_rcu(); + atomic_set(&module_state, MODULE_INACTIVE); }
void inc_module_count(void)
Modified: trunk/batman-adv-kernelland/main.h =================================================================== --- trunk/batman-adv-kernelland/main.h 2009-10-25 00:13:44 UTC (rev 1454) +++ trunk/batman-adv-kernelland/main.h 2009-10-25 00:13:47 UTC (rev 1455) @@ -63,7 +63,7 @@
#define MODULE_INACTIVE 0 #define MODULE_ACTIVE 1 -/* #define MODULE_WAITING 2 -- not needed anymore */ +#define MODULE_DEACTIVATING 2
/*
Modified: trunk/batman-adv-kernelland/send.c =================================================================== --- trunk/batman-adv-kernelland/send.c 2009-10-25 00:13:44 UTC (rev 1454) +++ trunk/batman-adv-kernelland/send.c 2009-10-25 00:13:47 UTC (rev 1455) @@ -399,7 +399,7 @@ /* if we still have some more bcasts to send and we are not shutting * down */ if ((forw_packet->num_packets < 3) && - (atomic_read(&module_state) != MODULE_INACTIVE)) + (atomic_read(&module_state) != MODULE_DEACTIVATING)) _add_bcast_packet_to_list(forw_packet, ((5 * HZ) / 1000)); else forw_packet_free(forw_packet); @@ -424,7 +424,7 @@ * shutting down */ if ((forw_packet->own) && - (atomic_read(&module_state) != MODULE_INACTIVE)) + (atomic_read(&module_state) != MODULE_DEACTIVATING)) schedule_own_packet(forw_packet->if_incoming);
forw_packet_free(forw_packet);