## How WRED Weights Packets

WRED bases its decisions about when to discard packets, and what percentage to discard, on the following four factors:

• The average queue depth

• The minimum threshold

• The maximum threshold

### The MPD

First, just like RED, WRED calculates the average queue depth. WRED then compares the average queue depth to the minimum and maximum thresholds to decide whether it should discard packets. If the average queue depth is between the two thresholds, WRED discards a percentage of the packets, with the percentage based on the MPD; if the average queue depth exceeds the maximum threshold, WRED discards all new packets.

To weight based on precedence or DSCP markings, WRED sets the minimum threshold, maximum threshold, and the MPD to different values per precedence or DSCP value. The average queue depth calculation, however, is not based on the precedence or DSCP value, but is instead calculated for all packets in the queue, regardless of the precedence or DSCP value.

An example of how WRED weights packets can help you make more sense out of how WRED behaves differently than RED. First, consider Figure 6-7, which happens to show the default settings for precedence 0.

Figure 6-7 Default WRED Settings for Precedence 0 for Thresholds and Percent to Discard

Figure 6-7 Default WRED Settings for Precedence 0 for Thresholds and Percent to Discard

Minimum Maximum

Threshold Threshold

Minimum Maximum

### Threshold Threshold

WRED calculates the average queue depth just like RED, ignoring precedence, but it decides when to discard packets based on the precedence or DSCP value. Suppose, for instance, that the average queue depth just passed 20. For new precedence 0 packets that need to be placed into the queue, WRED begins discarding some packets. If the average queue depth continues to increase toward 40, WRED continues to discard precedence 0 packets, but more aggressively, up to a rate of 10 percent, when the average queue depth reaches 40. After the average queue depth passes 40, WRED discards all new precedence 0 packets. In fact, if all packets were precedence 0, RED and WRED would behave identically.

The real differences between RED and WRED can be seen with more than one IP precedence value. Figure 6-8 shows the default WRED settings for precedence 0, with some different settings for precedence 3 traffic. (The settings in the figure do not match WRED's precedence 3 defaults, which are listed later in this section.)

Figure 6-8 Example WRED Settings for Precedences 0 and 3 for Thresholds and Discard Percent Discard

Figure 6-8 Example WRED Settings for Precedences 0 and 3 for Thresholds and Discard Percent Discard

Pecedence Pecedence Maximum Preœdenœ 3 0 Minimum 3 Minimum Threshold

Precedence 0 Threshold Threshold

Pecedence Pecedence Maximum Preœdenœ 3 0 Minimum 3 Minimum Threshold

### Precedence 0 Threshold Threshold

Suppose that the queue associated with the interface has a bunch of packets in it, marked with different precedence values, and the average queue depth just passed 20. For new precedence 0 packets that need to be placed into the queue, WRED begins discarding some precedence 0 packets, because the minimum threshold for precedence 0 is 20. WRED does not discard any precedence 3 packets, however, because the precedence 3 minimum threshold is 30. After the average queue depth reaches 30, WRED starts discarding precedence 3 packets as well. As the average queue depth reaches 40, precedence 0 packets are discarded at a rate approaching 10 percent, but precedence 3 packets are only discarded 5 percent of the time, because the MPD is set to 20, and 1/20 is 5 percent.

With the settings in this example, WRED discards precedence 0 packets earlier, and at a higher rate, as compared to precedence 3 packets. In short, the weighting feature of WRED just determines when WRED begins discarding a percentage of the packets (per-precedence minimum threshold), the maximum percentage discarded (based on per-precedence MPD), and the point at which WRED discards all packets of that precedence (based on the per-precedence maximum threshold).

IOS uses logical choices for the default settings for all WRED parameters. However, you can choose to override the parameters with configuration commands. Tables 6-4 and 6-5 list the IOS default values for minimum threshold, maximum threshold, and MPD with precedence-based WRED (Table 6-4) and DSCP-based WRED (Table 6-5).

Table 6-4 Cisco IOS Software-Default Values for Precedence-Based WRED

 Precedence Minimum Threshold Probability Denominator Calculated Maximum Percent Discarded 0 20 40 10 10% 1 22 40 10 10% 2 24 40 10 10% 3 26 40 10 10% 4 28 40 10 10% 5 31 40 10 10% 6 33 40 10 10% 7 35 40 10 10% RSVP* 37 40 10 10%

* RSVP = Resource Reservation Protocol

* RSVP = Resource Reservation Protocol

 DSCP** Minimum Threshold Probability Denominator Calculated Maximum Percent Discarded AF11, AF21, AF31, AF41 33 40 10 10% AF12, AF22, AF32, AF42 28 40 10 10% AF13, AF23, AF33, AF43 24 40 10 10% EF 37 40 10 10%

* Stated values for IOS 12.2 Mainline software.

** Class selector DSCP values use the same values as their corresponding IP precedence values' settings.

* Stated values for IOS 12.2 Mainline software.

** Class selector DSCP values use the same values as their corresponding IP precedence values' settings.

Cisco IOS Software follows the suggested meaning of all DSCP values, including the fact that these four AF DSCP values should be given equal treatment. The last digit of the name of the AF DSCP value identifies the drop preference, with 3 being most likely to be dropped, and 1

being least likely to be dropped. Note, for instance, that the settings for assured forwarding (AF) DSCPs AF11, AF21, AF31, and AF41 are all identical. For the same reason, AF12, AF22, AF32, and AF42 have the same defaults, as do AF13, AF23, AF33, and AF43.