/*
 * dsmark+policing - Dsmark with tcindex and policing
 *
 * Packets with non-zero TOS/DS field are marked with TOS 0xb8 (EF DSCP).
 * If they exceed the rate limit, they're dropped.
 */

#define LIMIT 1Mbps
#define BURST 10kB
#define MTU 1500B

#define TOS_ZERO	UDP_HDR($ip_tos=0)
#define TOS_NONZERO	UDP_HDR($ip_tos=1)
#define PAYLOAD		0 x 980		/* 1000-sizeof(iphdr) = 980 bytes */

dev eth0 10000 { /* 10 Mbps */
    dsmark (indices 64,set_tc_index) {
	class (0)
	    on tcindex(mask 0xff,pass_on) element (0);
	class (1,mask 0,value 0xb8)
	    on tcindex(mask 0) element (0)
	      police (rate LIMIT,burst BURST,mtu MTU) drop;
    }
}

every 0.005s send TOS_ZERO PAYLOAD		/* 1.6 Mbps */
every 0.005s send TOS_NONZERO PAYLOAD		/* 1.6 Mbps */

time 1s
end
