[P4-dev] Experiment for Priority Queue

Lok In Anson Leong anson93827 at gmail.com
Sun Nov 6 01:02:52 EST 2016


Hi Antonin,
The problem solved now.
It is because:
1) After uncommenting the line 42 in simple_switch.h., i forgot to
recompile the bmv2 once again.
2) There was no bottleneck link between switch and host3 in my environment.
Thank you so much!
Antonin Bas <antonin at barefootnetworks.com> 於 2016年11月3日週四 上午2:14寫道:

Hi,

After trying it on my end, I was able to make it work. I constrained all
links (in Mininet) to 100Mbps. I sent to UDP flows at 100Mbps (h1 -> h3 and
h2 -> h3). The flow h1 -> h3 received low priority (0) and the flow h2 ->
h3 received high priority (7). I didn't set any queue rate in bmv2 (so no
call to set_queue_rate in the CLI) to try to observe starvation of h1 -> h3.
What I observed was that h3 received packets from h1 at 20Mbps and from h2
at 80Mbps. So while h1 -> h3 wasn't starved, it was definitely dominated by
h2 -> h3.
A few things that could explain what you are seeing:
1) you need to make sure that you are writing to
intrinsic_metadata.priority in the ingress control flow (not the egress).
This is because the queueing happens between ingress and egress
2) you need to put a bandwidth constraint on your bottleneck link (sw <->
h3), otherwise it is not a bottleneck link... and both flows can be served
at 100Mbps. In my case all the links work at 100Mbps.

Hope that helps,

Antonin

On Wed, Nov 2, 2016 at 9:41 AM, Antonin Bas <antonin at barefootnetworks.com>
wrote:

Lok is actually correct. bmv2 supports priority queueing and all you need
to do in the P4 program is set the appropriate metadata field
(intrinsic_metadata.priority) to the value of your choice.
I will investigate the issue based on the P4 code and the runtime CLI
commands provided.

On Tue, Nov 1, 2016 at 11:41 PM, 胡鼎原 <hdy at bupt.edu.cn> wrote:

Hi,

As far as I know, queue priority is not defined in P4 specification.

It depends on switch hardware.

Bmv2 may not implement the queue algorithm.

Your P4 program running in bmv2 just write queue priority in ingress
process and do nothing.

---

Best Regards,

Dingyuan Hu

Beijing University of Posts and Telecommunications



*From: *P4-dev <p4-dev-bounces at lists.p4.org> on behalf of Lok In Anson
Leong <anson93827 at gmail.com>
*Date: *Wednesday, 2 November 2016 at 14:24
*To: *"p4-dev at lists.p4.org" <p4-dev at lists.p4.org>
*Subject: *[P4-dev] Experiment for Priority Queue



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: .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: .jpg]

[image: .jpg]

[image: .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: .jpg]

[image: .jpg]

[image: .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

_______________________________________________ P4-dev mailing list
P4-dev at lists.p4.org http://lists.p4.org/mailman/listinfo/p4-dev_lists.p4.org

_______________________________________________
P4-dev mailing list
P4-dev at lists.p4.org
http://lists.p4.org/mailman/listinfo/p4-dev_lists.p4.org




-- 
Antonin




-- 
Antonin

-- 

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/20161106/73cda2d6/attachment-0002.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image006.jpg
Type: image/jpeg
Size: 217991 bytes
Desc: not available
URL: <http://lists.p4.org/pipermail/p4-dev_lists.p4.org/attachments/20161106/73cda2d6/attachment.jpg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image005.jpg
Type: image/jpeg
Size: 195378 bytes
Desc: not available
URL: <http://lists.p4.org/pipermail/p4-dev_lists.p4.org/attachments/20161106/73cda2d6/attachment-0001.jpg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image003.jpg
Type: image/jpeg
Size: 217548 bytes
Desc: not available
URL: <http://lists.p4.org/pipermail/p4-dev_lists.p4.org/attachments/20161106/73cda2d6/attachment-0002.jpg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.jpg
Type: image/jpeg
Size: 145126 bytes
Desc: not available
URL: <http://lists.p4.org/pipermail/p4-dev_lists.p4.org/attachments/20161106/73cda2d6/attachment-0003.jpg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image002.jpg
Type: image/jpeg
Size: 197405 bytes
Desc: not available
URL: <http://lists.p4.org/pipermail/p4-dev_lists.p4.org/attachments/20161106/73cda2d6/attachment-0004.jpg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image007.jpg
Type: image/jpeg
Size: 147402 bytes
Desc: not available
URL: <http://lists.p4.org/pipermail/p4-dev_lists.p4.org/attachments/20161106/73cda2d6/attachment-0005.jpg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image004.jpg
Type: image/jpeg
Size: 201097 bytes
Desc: not available
URL: <http://lists.p4.org/pipermail/p4-dev_lists.p4.org/attachments/20161106/73cda2d6/attachment-0006.jpg>


More information about the P4-dev mailing list