On Tuesday 14 December 2010 10:58:09 Linus Lüssing wrote:
diff --git a/ndp.c b/ndp.c new file mode 100644 index 0000000..2dfb06d --- /dev/null +++ b/ndp.c @@ -0,0 +1,44 @@ +#include "main.h" +#include "send.h"
I think it would make more sense to have own_ndp_send_time() in ndp.c as it is not used anywhere else. We don't have to repeat the mistakes from the past. ;-)
+void start_ndp_timer(struct batman_if *batman_if) +{
- // adding some jitter
- unsigned long ndp_interval = own_ndp_send_time(batman_if);
- queue_delayed_work(bat_event_workqueue, &batman_if->ndp_wq,
ndp_interval - jiffies);
+}
+void stop_ndp_timer(struct batman_if *batman_if) +{
- cancel_delayed_work_sync(&batman_if->ndp_wq);
+}
Would you mind renaming these functions, so that they begin with ndp_*() ? Checkpatch does not like C99 style comments ("//").
+int ndp_init(struct batman_if *batman_if) +{
- atomic_set(&batman_if->ndp_interval, 500);
- atomic_set(&batman_if->ndp_seqno, 0);
- INIT_DELAYED_WORK(&batman_if->ndp_wq, ndp_send);
- return 0;
+}
Wouldn't it be better to initialize the ndp_interval in hardif_add_interface(), so that an interface disable/enable does not overwrite user specified ndp intervals ?
Cheers, Marek