xref: /dragonfly/share/examples/pf/ackpri (revision 6ca88057)
1# $OpenBSD: ackpri,v 1.2 2003/03/10 14:24:33 henning Exp $
2# $DragonFly: src/share/examples/pf/ackpri,v 1.1 2005/12/13 01:58:27 corecode Exp $
3
4# Use a simple priority queue to prioritize empty (no payload) TCP ACKs,
5# which dramatically improves throughput on (asymmetric) links when the
6# reverse direction is saturated. The empty ACKs use an insignificant
7# part of the bandwidth, but if they get delayed, downloads suffer
8# badly, so prioritize them.
9
10# Example: 512/128 kbps ADSL. Download is 50 kB/s. When a concurrent
11# upload saturates the uplink, download drops to 7 kB/s. With the
12# priority queue below, download drops only to 48 kB/s.
13
14# Replace lo0 with your real external interface
15
16ext_if="lo0"
17
18# For a 512/128 kbps ADSL with PPPoE link, using "bandwidth 100Kb"
19# is optimal. Some experimentation might be needed to find the best
20# value. If it's set too high, the priority queue is not effective, and
21# if it's set too low, the available bandwidth is not fully used.
22# A good starting point would be real_uplink_bandwidth * 90 / 100.
23
24altq on $ext_if priq bandwidth 100Kb queue { q_pri, q_def }
25queue q_pri priority 7
26queue q_def priority 1 priq(default)
27
28pass out on $ext_if proto tcp from $ext_if to any flags S/SA \
29	keep state queue (q_def, q_pri)
30
31pass in  on $ext_if proto tcp from any to $ext_if flags S/SA \
32	keep state queue (q_def, q_pri)
33
34