Znyx Networks bh5700 Fifo Qdiscs, Using Filters to Direct Packets to a COS Queue, Protocol ip

Models: bh5700

1 359
Download 359 pages 3.51 Kb
Page 115
Image 115

handle 100:0

root

pfifo limit 32

Defines the handle for the queuing discipline. This handle may be used to reference the pfifo queue. Note that the handle is included with the output of the qdisc ls command. (100:0 and 100: are equivalent in tc.) The choice of handle is significant for zqosd.

Tells tc that this is the base queuing discipline for the device, not a child of another queuing discipline.

Specifies a packet-limited FIFO queue with an upper bound of 32 packets.

Now, delete the queuing discipline from zhp0 and confirm that it has been removed:

tc qdisc del dev zhp0 root tc qdisc ls

Fifo Qdiscs

The length of the queues for each port may need to be limited to avoid filling the available memory with packets which cannot be transmitted as fast as they are received. To limit the length of a particular queue, a bfifo qdisc is defined.

tc qdisc add dev zre5 parent 105:1 bfifo limit 5kb

This limits queue 0 on zre5 to no more than 5k bytes of data.

Using Filters to Direct Packets to a COS Queue

Once the queues are defined for a port, filters can be added to direct the desired packets into the queue. The target queue is identified by the classid parameter, which is the same as the handle of the cos queue. For example, to send unicast packets with a destination IP address of 10.91.100.5 to cos queue 3 created above, the filter is:

tc filter add dev zre5 parent 105: protocol ip u32 match ip dst 10.91.100.5/32 classid 105:4

Protocol ip

The u32 filter allows matching many fields of the IP packet, including: ip src, ip dst, ip tos, ip protocol, ip sport, ip dport, ip icmp_type and ip icmp_code. Each field to match except the IP addresses is specified as:

match <field name> <value> <mask>

where <value> and <mask> are numerical values. The ip tos field is an 8 bit field, with the ip precedence in the upper 3 bits, the type of service in the next 3 bits, and the ecn bits in the lower 2 bits. The same field can be selected as dsfiled followed by the DSCP in the upper six bits and the ecn in the remaining two bits. The mask specifies which bits are to match, so

Ethernet Switch Blade User's Guide

release 3.2.2j

page 115

Page 115
Image 115
Znyx Networks bh5700 manual Fifo Qdiscs, Using Filters to Direct Packets to a COS Queue, Protocol ip