sm0svx / svxlink

Advanced repeater system software with EchoLink support for Linux including a GUI, Qtel - the Qt EchoLink client
http://svxlink.org/
Other
432 stars 170 forks source link

QoS for voice data #113

Open pe1chl opened 9 years ago

pe1chl commented 9 years ago

For interconnection of the repeaters and connection to internet we use an intermediate network that has limited bandwidth. When overloaded it drops packets. It appears that this sometimes resulted in clicks in the audio of Echolink users, but I also noticed a complete breakup of remotetrx audio when I did an "apt-get upgrade" on one of the systems. So, I implemented traffic shaping in our systems (Linux "tc" command to setup a shaper with speed lower than the maximum network speed, and a 3-level priority queue for low/normal/high priority network traffic. I decided to match only on the IP priority field (DSCP), and to set the DSCP using iptables. In such cases it is most convenient when the applications already set DSCP, so it is not required to do all sorts of protocol/port matching in iptables to correct it (at all systems...). Therefore here is a feature request: option to set the DSCP for connections used to transport voice traffic (remotetrx, echolink port 5198, UDP audio devices). Code is simple enough:

int optvalue = IPTOS_DSCP_EF;
if (setsockopt(sfd,IPPROTO_IP,IP_TOS,&optvalue,sizeof(optvalue)) < 0)
    perror("setsockopt IP_TOS");

This sets the DSCP EF (Expedited Forwarding) value (0xb8) found in netinet/ip.h which is often used to indicate voice traffic. It could be hardcoded (should not hurt), it could be made optional on/off, or it could be a configurable value so other values can be set when required.

f5vmr commented 9 years ago

Very interesting. Our current router is connected to the master modem over 48 kms Using 2.5 GHz and two bullets. Speed is quite remarkable 3-6 Mbs depending on fog or rain. It carries echo link (when it is on) and data from three other systems we host at our repeater. It is via this link we expect to take our remote receivers when they come on stream.

pe1chl commented 9 years ago

Do you have QoS issues as well? E.g. the voice stutters when you download something over the same link. Some WiFi equipment supports QoS as well, i.e. it will maintain separate queues for expedited and background traffic and send the expedited traffic first. You can mark the voice traffic in the iptables -t mangle -A POSTROUTING chain using -j DSCP --set-dscp-class ef.

f5vmr commented 9 years ago

Not an issue I have encountered yet. The only stutter problem I had noticed so far was the processor being over-busy. We'll confer later when the install is made on site.

Chris

F5VMR

sm0svx commented 9 years ago

The best thing is if you implement this yourself, test it and create a pull request. Have a look at the Contributing Code Wiki page.