p4-learning icon indicating copy to clipboard operation
p4-learning copied to clipboard

Priority queuing in Simple Switch

Open tuananh01 opened this issue 2 years ago • 4 comments

Hello everyone,

I'm using the latest Development VM released in April. I've read the BMv2 Simple Switch article and also looked into the multiqueuing.p4 example. They all said that if I want to use multiple priority queues, I have to uncomment the line: #define SSWITCH_PRIORITY_QUEUEING_ON

But when I go to the simple_switch.h file at the directory /home/vagrant/behavioral-model/targets/simple_switch, I can't find the above line, what I saw is in the following image: image So my question is do I need to type the line #define SSWITCH_PRIORITY_QUEUEING_ON like you see in the image, then compile and install bmv2 again to use the feature?

Also when I scroll down, I see this: image Am I supposed to changes the `default_nb_queues_per_port = 1 to another value? Does changing this value has the same effect as I use multiple priority queues?

Thanks!

`

tuananh01 avatar Apr 16 '23 08:04 tuananh01

See my answer here: https://forum.p4.org/t/priority-queueing/743

If the p4-learning repo uses source code of the p4lang/behavioral-model repository after the enhancement was made, I would recommend updating the instructions in this repo, since changing the source code and recompiling is no longer necessary.

jafingerhut avatar Apr 17 '23 18:04 jafingerhut

Hi @jafingerhut!

Thanks for the info. I will have a look at it and update it as soon as possible.

edgar-costa avatar Apr 17 '23 18:04 edgar-costa

How can i add the -- --priority-queues 8 in p4app.json or somewhere?


i simply modify the /<path to p4-utils>/p4utils/mininetlib/node.py as below and reinstall p4-utils. It works. Is there a easy way to allow user to add custom options to simple_switch?

def add_arguments(self):
        """Adds arguments to the simple switch process"""
        args = [self.sw_bin]
        for port, intf in list(self.intfs.items()):
            if not intf.IP():
                args.extend(['-i', str(port) + '@' + intf.name])
        if self.pcap_dump:
            if self.pcap_dir:
                args.append('--pcap=' + self.pcap_dir)
            else:
                args.append('--pcap')
        if self.thrift_port:
            args.extend(['--thrift-port', str(self.thrift_port)])
        if self.nanomsg:
            args.extend(['--nanolog', self.nanomsg])
        args.extend(['--device-id', str(self.device_id)])
        if self.json_path:
            args.append(self.json_path)
        else:
            args.append('--no-p4')
        if self.enable_debugger:
            args.append('--debugger')
        if self.log_enabled:
            args.append('--log-console')
/*modify begin*/
        args.extend(['-- --priority-queue', str(8)])
/*end*/
        return args

WigginsLi avatar Jun 17 '23 03:06 WigginsLi

Hi @WigginsLi,

I recently added the option.

This p4-learning example already uses it (just check the readme or the topology files): https://github.com/nsg-ethz/p4-learning/tree/master/examples/multiqueueing

edgar-costa avatar Oct 23 '23 14:10 edgar-costa