[Freeswitch-dev] MTU setting and application buffer size

Juraj Fabo juraj.fabo at gmail.com
Mon Sep 19 20:30:36 MSD 2011


I'm writing and application using freetdm library and also a testtool
which works as a loopback for voice data on B channels.
Server A is running the loopback test tool is with a104d sangoma card
configured in NET mode simulating telko infrastructure, clock on each
span set to MASTER.
Server B  is running target aplication with 2 a102de cards configured
in CPE mode and clock on each span is set to NORMAL.
Spans of two serversSpans are connected with E1 cables, both servers
running in sles11 sp1.
Target application is reading/writing from/to another network stack
A-law data with 20ms frame length.

With default MTU settings (80) I am experiencing latency which I
consider too high, it is about 400ms from targetApp to loopback and
back to targetApp.

I think I missed some point about proper setting of MTU and consequences.
Decreasing the MTU configuration setting in the
/etc/wanpipe/wanpipe1.conf from default value 80 to e.g 40 or 16 leads
to desired lower latency, however, the data the targetApp is reading
are often corrupted with many gaps.
Please, what is the proper way of setting MTU?
I assume I have to set the same MTU per wXg1 sections in
/etc/wanpipe/wanpipeX.conf files on both servers, since the serverA
card is providing a clock for server B cards.
Is it necessary to change the value of codec_ms in the
/usr/local/freetdm/conf/wanpipe.conf ?

I also noticed following behaviour of ifconfig:
a. MTU set to 40 or higher in section w1g1 in wanpipe1.conf
    also all other spans of the card which has the w1g1 (so w2g1 for
the dualspan and w2g1, w3g1,w4g1 for quad card) will be displayed in
ifconfig output with MTU: 40

b. MTU set to 80 or higher (e.g. 160) in section w1g1 in wanpipe1.conf
    ifconfig will display MTU:80 also for higher values

Finally, I tried to access the card more often than the default 20ms
with default MTU:80
Since 80Bytes is 10ms, application was configured to read/write on
10ms rate with 80Bytes buffer.
Following pseudocode ftdm_channel_read(fchan, bufferPtr, 80) failed
with kernel error message in dmesg coming from wanpipe_tdm_api.c
"User API Error: User Rx Len=144 < Driver Rx Len=224 (hdr=64). User
API must increase expected rx length"
Does it mean, that the smallest buffer used in the ftdm_channel_read()
must be at least 160 B length even if MTU is 80 (or less) ?

Thank you very much


Join us at ClueCon 2011 Aug 9-11, 2011
More information about the FreeSWITCH-dev mailing list