[P4-dev] Exiting out of the ingress based on a condition(ACL rule)

aditya dogra dogra.aditya at gmail.com
Thu Nov 30 00:04:10 EST 2017


Hi ,
     Is there a way in the p4-16 program we can jump out of the ingress
block based on an ACL or a table entry ?

We have a table which specifies whether we need to encap the packet or not
. If the table specifies that encap rule is specified , we should encap the
packet in new format , else we should exit out of the ingress block and let
it egress normally (we dont want packet to get drop). We tried "exit"
statement , however "exit" in condition gives an error . *Is there any
specific way we need to do exit or jump from the control block ? *


p4c-bm2-ss --p4v 16 "insert_new_hdr.p4" -o "insert_new_hdr.p4.json"
*insert_new_hdr.p4(377): error: exit: Conditional execution in actions is
not supported on this target*
          exit;
          ^^^^

Table entry is : *table_set_default node_source node_sourcing 3*

*Pseudocode *

const bit<8>  NO_OP_NODE = 0x03;

ingress block {


    action node_sourcing(nodeType_t node_type) {

       if (NO_OP_NODE == node_type){
          /* COME OUT OF THE INGRESS .. DONT DO ANYTHING AT ALL */
          exit;
       }

    }


        table node_source {
            actions        = { node_sourcing; NoAction; }
            default_action =  NoAction();
    }


        apply {
            if (condition1) {


                node_source.apply();   ==> If the ACL ot table entry doesnt
match , we should be to exit out of the ingress block and continue with the
egress block .


                if (condition2)
                {
                     add_some_extra_header();
                     new_hdr.apply();
                } else if (condition3)

                {
                    if(new_condition)
                    {
                       add_new_hdr2_option();
                    }
                    new_hdr.apply();
                }

            }
        }
    }


}



Regards,
Aditya Dogra
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.p4.org/pipermail/p4-dev_lists.p4.org/attachments/20171130/ec5e1f95/attachment-0002.html>


More information about the P4-dev mailing list