[P4-dev] Resubmit Primitive and Instance_type in bmv2

hemant at mnkcg.com hemant at mnkcg.com
Sat Aug 18 17:59:48 EDT 2018


Hi Yukinari,

 

Sorry, I don’t work with P4-14.  I will use the p4c compiler to convert the program to P4-16 and then see if I find anything wrong.  

 

Thanks,

 

Hemant

 

From: Yukinari He <yukinari.eed03 at g2.nctu.edu.tw> 
Sent: Saturday, August 18, 2018 3:49 PM
To: hemant at mnkcg.com; p4-dev at lists.p4.org
Subject: RE: [P4-dev] Resubmit Primitive and Instance_type in bmv2

 

Him Hermant,

 

Thanks for the reply, I would give it a try later.

 

Also, the below is the full program written in p4-14. Is there any logical error in my program?

 

field_list resubmit_field {

    standard_metadata;

    intrinsic_metadata;

    tmp;

}

 

action do_resubmit(){

    modify_field(standard_metadata.ingress_port, 1);

    resubmit(resubmit_field);

}

table resubmit_new_pkt{

    actions {

        do_resubmit;

    }

}

 

action next_iteration(){

    add_to_field(standard_metadata.ingress_port, 1);

    resubmit(resubmit_field);

}

table start_next_iter{

    actions {

        next_iteration;

    }

}

control ingress{

    apply(read_port_num);

    if(standard_metadata.instance_type == 6){

        // to perform a loop: port 1 to tmp.port_num(writing in registers by RuntimeCmd)

        if(standard_metadata.ingress_port <= tmp.port_num){

            apply(get_best_hop_info);  //read something from registers

            if(tmp.traffic >= tmp.best_hop_traffic){

                apply(best_hop_update); //write something to registers

            }

        }

            if(standard_metadata.ingress_port < tmp.port_num)

            apply(start_next_iter);

    }

    else{

        apply(resubmit_new_pkt);  // new pkts, resubmit

    }

}

 

Thanks,

Yukinari

 

寄件者: hemant at mnkcg.com <mailto:hemant at mnkcg.com> 
傳送時間: 2018年8月19日 上午 03:21
收件者: 'Yukinari He' <mailto:yukinari.eed03 at g2.nctu.edu.tw> ; p4-dev at lists.p4.org <mailto:p4-dev at lists.p4.org> 
主旨: RE: [P4-dev] Resubmit Primitive and Instance_type in bmv2

 

You could use gdb and debug what happens to standard_metadata.instance_type

 

Also, if the full P4 program can be shared, we could take a look.

 

Thanks,

 

Hemant

 

From: P4-dev <p4-dev-bounces at lists.p4.org <mailto:p4-dev-bounces at lists.p4.org> > On Behalf Of Yukinari He
Sent: Saturday, August 18, 2018 12:27 PM
To: p4-dev at lists.p4.org <mailto:p4-dev at lists.p4.org> 
Subject: [P4-dev] Resubmit Primitive and Instance_type in bmv2

 

Hi,

 

I just complete a program with resubmit() as I’d like to deal with a loop-like behavior. I make standatd_metadata.instance_type as a field to check if a packet is resubmitted. However, I find that the condition which aims to check if the packet is resubmitted is never satisfied, so I’m not sure if the resubmit() is executed. 

 

Below is the pseudo-code of my program:

Ingress{

        // do something, Part A

        If standard_metadata.instance_type == 6

            If indicator < limit

              // do something and resubmit again, Part B

       Else if standard_metadata.instance_type != 6

                Resubmit()

}

 

I expect that when a packet comes, the switch should do something and resubmit it. The switch will then do Part A again and execute Part B as well for resubmitted packets until the termination condition comes true, but I find that the condition “standard_metadata.instance_type == 6” is never satisfied and the instance_type is always 0.

 

Are there any mistakes I made?

 

Thanks,

Yukinari

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.p4.org/pipermail/p4-dev_lists.p4.org/attachments/20180818/e45ef4ed/attachment.html>


More information about the P4-dev mailing list