All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andy Furniss <andy.furniss@dsl.pipex.com>
To: lartc@vger.kernel.org
Subject: Re: [LARTC] tc rules for Internet Radio
Date: Fri, 19 Nov 2004 21:30:59 +0000	[thread overview]
Message-ID: <419E6613.7040905@dsl.pipex.com> (raw)
In-Reply-To: <200411161702.45717.Martin.Ward@durham.ac.uk>

Martin Ward wrote:
> I am currently using the ultimate-tc script from 
> http://lartc.org/howto/lartc.cookbook.ultimate-tc.html
> and I want to make sure that internet radio packets (mp3 streaming audio)
> will always get through no matter what. I have added some iptables commands
> like this:
> 
> iptables -A OUTPUT -t mangle -p tcp --dport 8000 -j TOS --set-tos 
> Minimize-Delay
> iptables -A OUTPUT -t mangle -p tcp --sport 8000 -j TOS --set-tos 
> Minimize-Delay

OUTPUT only sees locally generated packets.

> 
> with the aim of marking the streaming audio packets so that they will get
> a higher priority: but I'm not sure if this is needed or exactly how it works!
> 
> Some audio streams come in with the incoming packets marked [tos 0x40] and
> the outgoing packets marked [tos 0x10] (according to tcpdump) but not all.
> 

I would use MARK as other traffic may have TOS set, see below.

> The ultimate-tc script ends with these ingress rules:
> 
> ########## downlink #############
> # slow downloads down to somewhat less than the real speed  to prevent 
> # queuing at our ISP. Tune to see how high you can set it.
> # ISPs tend to have *huge* queues to make sure big downloads are fast
> #
> # attach ingress policer:
> 
> tc qdisc add dev $DEV handle ffff: ingress
> 
> # filter *everything* to it (0.0.0.0/0), drop everything that's
> # coming in too fast:
> 
> tc filter add dev $DEV parent ffff: protocol ip prio 50 u32 match ip src \
>    0.0.0.0/0 police rate ${DOWNLINK}kbit burst 10k drop flowid :1
> 
> 
> This will drop packets to keep the download rate just below the maximum
> capacity of the link: which will keep the ISP's queue empty and improve
> latency. But I am concerned that if there are a *lot* of other download
> streams going at the same time as my audio stream, then these rules
> may drop lots of packets from the audio stream and cause it to skip.
> 
> Should I add rules to drop audio stream packets at ${DOWNLINK}kbit rate
> and drop all other traffic at $[9*$DOWNLINK/10]kbit rate, in the same way
> that ultimate-tc does for outgoing traffic? If so, what should the rules look
> like?

There are lots of complicated things you can do with policers/u32 but I 
have no experience.

First thoughts are to mark all that aren't -sport 8000 and change the 
police rule to police to police marked.

iptables -A PREROUTING -t mangle -p tcp ! --sport 8000 -j MARK --set-mark 1

tc qdisc add dev $DEV handle ffff: ingress

tc filter add dev $DEV parent ffff: protocol ip prio 1 handle 1 fw 
police rate ${DOWNLINK}kbit burst 10k drop flowid :1

I haven't tested that.


> 
> Something else I don't understand about ultimate-tc is that the high priority
> class gets a rate of ${UPLINK}kbit and the low priority class gets
> $[9*$UPLINK/10]kbit: but doesn't the rate refer to traffic *in that class*.
> Traffic-Control-HOWTO Section 7.1.5. (Rules) says:
> "Ideally, the sum of the rates of the children classes would match the rate of
> the parent class, allowing the parent class to distribute leftover bandwidth
> (ceil - rate) among the children classes." but this isn't the case for the
> ultimate-tc script. 
> 

I don't do it like that - I use ceil and like my rates to add up - but I 
suppose it works OK.

Andy.

_______________________________________________
LARTC mailing list / LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/

  reply	other threads:[~2004-11-19 21:30 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-11-16 17:02 [LARTC] tc rules for Internet Radio Martin Ward
2004-11-19 21:30 ` Andy Furniss [this message]
2004-11-19 23:51 ` Andy Furniss

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=419E6613.7040905@dsl.pipex.com \
    --to=andy.furniss@dsl.pipex.com \
    --cc=lartc@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.