Add fairq to altq. Fairq is a fair queueing algorithm with bandwidth
authorMatthew Dillon <dillon@dragonflybsd.org>
Sun, 6 Apr 2008 18:58:16 +0000 (18:58 +0000)
committerMatthew Dillon <dillon@dragonflybsd.org>
Sun, 6 Apr 2008 18:58:16 +0000 (18:58 +0000)
commit5950bf012141c44015077a307c63f38119b6e140
tree4ac24b68a6bd658b00cd34310cb9ac1566b20755
parent96c9b0231cc7a29b2f22d0555ce435c54f29c351
Add fairq to altq.  Fairq is a fair queueing algorithm with bandwidth
prioritization and a bandwidth delimiter (hogs) to allow low bandwidth
buckets to jump the round robin.  This fairq algorithm is currently unweighted
but traffic can still be classified with the global priority model.  For
each queue traffic is normally round robined by taking a packet from each
bucket in turn.

This feature is primarily intended for edge routers and egress points with
bandwidth constrictions.

* Hogs feature allows low bandwidth buckets to burst.  Low bandwidth can
  mean, e.g. an interactive shell or even simply ack traffic, without
  the need to explicitly classify it.  Bandwidth is managed on a per-bucket
  basis.

* Prioritization feature allows minimum guaranteed bandwidths based on
  service classifications. e.g. VOIP, web, mail, PtP, etc.

* Weighted fairq not implemented (beyond using classification into priority
  queues), but the circular bucket design makes it a fairly easy task if
  someone wants to do it.

* Add ALTQ_MBUF_STATE_HASHED and generate a hash of the connection state
  in the mbuf header for any packet that you have set 'keep state' for
  in pf.  This is done in PF and is needed by fairq to bucketize
  'connections'.

* Add the fairq implementation and a new ALTQ_FAIRQ kernel build option.

* Simple example included below.

ports="{ 25, 80 }"
altq on vke0 fairq bandwidth 500Kb queue { normal, bulk }
queue bulk priority 1 bandwidth 100Kb \
        fairq(buckets 64, hogs 25Kb) qlimit 50
queue normal priority 2 bandwidth 400Kb \
        fairq(buckets 64, hogs 25Kb, default) qlimit 50

pass out on vke0 inet proto tcp from any to any \
        keep state queue normal
pass out on vke0 inet proto tcp from any to any port $ports \
        keep state queue bulk
16 files changed:
sys/conf/files
sys/conf/options
sys/config/LINT
sys/net/altq/altq.h
sys/net/altq/altq_fairq.c [new file with mode: 0644]
sys/net/altq/altq_fairq.h [new file with mode: 0644]
sys/net/altq/altq_subr.c
sys/net/altq/altq_var.h
sys/net/pf/pf.c
sys/net/pf/pfvar.h
sys/sys/mbuf.h
usr.sbin/pfctl/parse.y
usr.sbin/pfctl/pf.conf.5
usr.sbin/pfctl/pfctl_altq.c
usr.sbin/pfctl/pfctl_parser.h
usr.sbin/pfctl/pfctl_qstats.c