A method of policing network traffic based on congestion on a flow-based programmable switch, such as an OpenFlow switch is provided. The method polices congestion-causing flows in a network by detecting congestion at a flow-based programmable switch on the network. Once congestion has been detected, the method identifies one or more flows that are causing the congestion at the flow-based programmable switch, and penalizes the flows that were identified as causing congestion. A flow-based programmable switch including a data plane having input ports, output ports, and forwarding rules that map packets received on an input port to an output port based on a packet matching a rule in the forwarding rules is also described.