[asterisk-dev] Re: TDMoE protocol

Tony Mountifield tony at softins.clara.co.uk
Fri Feb 24 06:10:31 MST 2006

In article <AEC6C66638C05B468B556EA548C1A77DAF0A04 at trantor>,
James Harper <james.harper at bendigoit.com.au> wrote:
> > 
> > However, I don't think ztdummy as it stands is quite accurate enough
> > for governing TDMoE, because it doesn't maintain a 1ms spacing. Since
> > the RTC can only do power-of-2 subdivisions of a second, it is set to
> > 1/1024 sec (0.9765625ms), but then 3 interrupts out of every 128 are
> > skipped (evenly spaced) to give an average of 1000 per second. This
> > is ok for VoIP with a 20ms or 30ms frame size, but not for TDMoE with
> > a packet every 1ms. I would probably try making ztdummy use 4096 RTC
> > interrupts per second and skip 3096 of them. This would make the
> > interval between two consecutive packets either 0.9765625ms or
> > 1.220703125ms.
> I've always wondered how you got 1000 ticks out of 1024 without a bit of
> inaccuracy. So if you are skipping 3 ticks per 1024, 3 intervals are
> going to be ~1.8ms apart. I can see why that would be a problem!
> What do you see as being the overhead of doing 4096 interrupts/second,
> given that the handler for at least 3096 of them is going to be _very_
> fast? Any reason why not to go to 8192?

See my posting to Paul Cadach on this topic. when I get a moment, I'll
update my ztdummy to make it a module parameter that can be specified
in modprobe.conf or modules.conf. A fast system should be able to cope
with 8192.

> Also, doesn't the 2.6 kernel run on 1khz timing? Why isn't this used
> (I'm sure there's a good reason, I'm just curious to know what it is!)?

Before 2.6.13, all kernels defaulted to 1000Hz. However, the older ztdummy
under 2.6 used a hook into the kernel jiffy counter, and occasionally
didn't get called. This resulted in large delays building up on IAX and
SIP channels into MeetMe (there were also other sources of delay, but this
was definitely one). Adding the hooks into the RTC instead fixed that
particular source of delay.

When 2.6.13 came along, the default was no longer 1000Hz, so it was even
more necessary for ztdummy to use the RTC as an independent timing source.

Tony Mountifield
Work: tony at softins.co.uk - http://www.softins.co.uk
Play: tony at mountifield.org - http://tony.mountifield.org

More information about the asterisk-dev mailing list