[P4-dev] Experiment for Priority Queue

Lok In Anson Leong anson93827 at gmail.com
Wed Nov 2 02:24:42 EDT 2016


Hi all,

I am doing an experiment for priority queue in P4.
I have enabled the priority queue by uncommenting the line 42 in
simple_switch.h. Also, i have defined the intrinsic_metadata.priority field
in my P4 program.

The picture below is my experiment environment.
[image: 1.jpg]
There are four computers in this environment. Three of them are hosts and
one P4 bmv2 switch. On port 3, i set the rate and depth to 5000. Other
ports were default setting. The priority of UDP service in host 1 was set
to 0 (lowest) and host 2 was set to 7 (highest). I was using iperf to send
UDP datagram (100Mbps in 300 seconds) from host 1 & 2 to host 3 almost at
the same time.

I also find some instruction of priority queue: "If no maximum rate is set,
queues with a high priority can starve lower-priority queues."(
https://github.com/p4lang/behavioral-model/blob/deace1c9ba1b23ece3bf5f534db38c560c7ed6ff/include/bm/bm_sim/queueing.h#L397).
Theoretically,
host 1 will starve because host 2 get the higher priority. But, I can't get
this theoretically result in my experiment.

The pictures below are the testing result.
[image: 2.jpg]
[image: 3.jpg]
[image: 4.jpg]
The values of transfer and bandwidth in host 1 and host 2 were very
approaching. There was no starvation.

On the other hand, I try to use default setting for all ports (take away
the set_queue_rate and set_queue_depth) and test it again.
[image: 5.jpg]
[image: 6.jpg]
[image: 7.jpg]
Also got the same result.

Here is my part of P4 code.
/*-------part of p4 code----------*/
header_type intrinsic_metadata_t {
fields {
mcast_grp : 4;
egress_rid : 4;
mcast_hash : 16;
lf_field_list: 32;
ingress_global_timestamp : 48;
priority : 8;
}
}
action set_if_info1(out_port, priority) {
modify_field(standard_metadata.egress_spec, out_port);
modify_field(intrinsic_metadata.priority, priority);
}
table mac_if_info {
reads {
ethernet.dstAddr : exact;
ipv4.srcAddr : exact;
ipv4.dstAddr : exact;
ipv4.protocol : exact;
}
actions {
_drop;
set_if_info1;
}
size: 128;
}
/*-------part of p4 code----------*/

/*-------command.txt----------*/
table_add mac_if_info set_if_info1 1c:1b:0d:10:85:7a 10.0.0.12 10.0.0.10 17
=> 1 7
table_add mac_if_info set_if_info1 1c:1b:0d:10:86:cd 10.0.0.10 10.0.0.12 17
=> 3 7
table_add mac_if_info set_if_info1 1c:1b:0d:10:85:97 10.0.0.12 10.0.0.11 17
=> 2 0
table_add mac_if_info set_if_info1 1c:1b:0d:10:86:cd 10.0.0.11 10.0.0.12 17
=> 3 0
set_queue_rate 5000 3
set_queue_depth 5000 3
/*-------command.txt----------*/

Thank you very much!!
-- 

Best Regards,
Anson Liang Lok In(梁樂賢)
National Chung Cheng University
Department of Communication Engineering
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.p4.org/pipermail/p4-dev_lists.p4.org/attachments/20161102/6d140e9f/attachment-0002.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 1.jpg
Type: image/jpeg
Size: 145125 bytes
Desc: not available
URL: <http://lists.p4.org/pipermail/p4-dev_lists.p4.org/attachments/20161102/6d140e9f/attachment.jpg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 2.jpg
Type: image/jpeg
Size: 197404 bytes
Desc: not available
URL: <http://lists.p4.org/pipermail/p4-dev_lists.p4.org/attachments/20161102/6d140e9f/attachment-0001.jpg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 3.jpg
Type: image/jpeg
Size: 217547 bytes
Desc: not available
URL: <http://lists.p4.org/pipermail/p4-dev_lists.p4.org/attachments/20161102/6d140e9f/attachment-0002.jpg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 4.jpg
Type: image/jpeg
Size: 201096 bytes
Desc: not available
URL: <http://lists.p4.org/pipermail/p4-dev_lists.p4.org/attachments/20161102/6d140e9f/attachment-0003.jpg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 5.jpg
Type: image/jpeg
Size: 195377 bytes
Desc: not available
URL: <http://lists.p4.org/pipermail/p4-dev_lists.p4.org/attachments/20161102/6d140e9f/attachment-0004.jpg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 6.jpg
Type: image/jpeg
Size: 217990 bytes
Desc: not available
URL: <http://lists.p4.org/pipermail/p4-dev_lists.p4.org/attachments/20161102/6d140e9f/attachment-0005.jpg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 7.jpg
Type: image/jpeg
Size: 147401 bytes
Desc: not available
URL: <http://lists.p4.org/pipermail/p4-dev_lists.p4.org/attachments/20161102/6d140e9f/attachment-0006.jpg>


More information about the P4-dev mailing list