b.a.t.m.a.n.lists.open-mesh.org archive mirror
 help / color / mirror / Atom feed
* [B.A.T.M.A.N.] still jiffies - msecs mixup?
@ 2010-06-19 15:15 Linus Lüssing
  2010-06-19 22:50 ` Marek Lindner
  0 siblings, 1 reply; 2+ messages in thread
From: Linus Lüssing @ 2010-06-19 15:15 UTC (permalink / raw)
  To: b.a.t.m.a.n

Hmm, while scanning through the code, there were some things that
looked a little odd to me...
---
chedule_own_packet() (/ schedule_forward_packet() )
  -> send_time = own_global_send_time(bat_priv) (/forward_send_time(bat_priv))
     <- returns current jiffies + orig_interval(in ms!) from bat_priv + jitter(in ms?)

  -> can_aggregate_with(send_time)
     -> converts MAX_AGGREGATION_MS to jiffies, seems to expect send_time to be in jiffies format

  -> new_aggregated_packet(send_time)
     -> queue_delayed_work(send_time - jiffies), 
        -> so, queue_delayed_work(orig_interval + jitter - time_diff_in_jiffies + MAX_AGGREGATION(in jiffies))?
---

Looks like we'd have some portions in the send_time still in
jiffies format, though it should be a time purely in msecs for
queue_delayed_work if I'm not mistaken.
If this is really a bug, would it be better to deal with jiffies
in these places (so converting orig_interval to jiffies) and
convert it back when queueing the work, or better convert the
jiffies variable to msecs and skipping all the other
msecs_to_jiffies conversions?

Cheers, Linus

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [B.A.T.M.A.N.] still jiffies - msecs mixup?
  2010-06-19 15:15 [B.A.T.M.A.N.] still jiffies - msecs mixup? Linus Lüssing
@ 2010-06-19 22:50 ` Marek Lindner
  0 siblings, 0 replies; 2+ messages in thread
From: Marek Lindner @ 2010-06-19 22:50 UTC (permalink / raw)
  To: The list for a Better Approach To Mobile Ad-hoc Networking

On Saturday 19 June 2010 17:15:40 Linus Lüssing wrote:
> schedule_own_packet() (/ schedule_forward_packet() )
>   -> send_time = own_global_send_time(bat_priv)
> (/forward_send_time(bat_priv)) <- returns current jiffies +
> orig_interval(in ms!) from bat_priv + jitter(in ms?)

The orig_interval and jitter are transformed to jiffies (towards the end of the 
line). It is not very obvious and might be susceptible for overflows. We 
probably should use msecs_to_jiffies() here.


>   -> can_aggregate_with(send_time)
>      -> converts MAX_AGGREGATION_MS to jiffies, seems to expect send_time
> to be in jiffies format

Correct - we have jiffies here.


>   -> new_aggregated_packet(send_time)
>      -> queue_delayed_work(send_time - jiffies),
>         -> so, queue_delayed_work(orig_interval + jitter -
> time_diff_in_jiffies + MAX_AGGREGATION(in jiffies))? ---
> 
> Looks like we'd have some portions in the send_time still in
> jiffies format, though it should be a time purely in msecs for
> queue_delayed_work if I'm not mistaken.

You are mistaken.  :-)
workqueue.c:323 [right above queue_delayed_work()] says: 
@delay: number of jiffies to wait before queueing

Regards,
Marek

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-06-19 22:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-06-19 15:15 [B.A.T.M.A.N.] still jiffies - msecs mixup? Linus Lüssing
2010-06-19 22:50 ` Marek Lindner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).