TNSM_Latency_Prediction / code / control / ingress / 2_custom / ingress.p4
ingress.p4
Raw
control Ingress(
                /* User */
                inout my_ingress_headers_t                       hdr,
                inout my_ingress_metadata_t                      meta,
                /* Intrinsic */
                in    ingress_intrinsic_metadata_t               ig_intr_md,
                in    ingress_intrinsic_metadata_from_parser_t   ig_prsr_md,
                inout ingress_intrinsic_metadata_for_deparser_t  ig_dprsr_md,
                inout ingress_intrinsic_metadata_for_tm_t        ig_tm_md)
{


#ifdef ACTION_ARG1
    #include"actions/actions_arg1.p4"
#elif ACTION_ARG2
    #include"actions/actions_arg2.p4"
#elif ACTION_ARG3
    #include"actions/actions_arg3.p4"
#elif ACTION_ARG3
    #include"actions/actions_arg4.p4"
#endif

#include"actions/actions.p4"

#ifdef WITH_T1
    #include "tables/table1.p4"
#endif
#ifdef WITH_T2
    #include "tables/table2.p4"
#endif
#ifdef WITH_T3
    #include "tables/table3.p4"
#endif
#ifdef WITH_T4
    #include "tables/table4.p4"
#endif
#ifdef WITH_T5
    #include "tables/table5.p4"
#endif
#ifdef WITH_T6
    #include "tables/table6.p4"
#endif
#ifdef WITH_T7
    #include "tables/table7.p4"
#endif
#ifdef WITH_T8
    #include "tables/table8.p4"
#endif
#ifdef WITH_T9
    #include "tables/table9.p4"
#endif
#ifdef WITH_T10
    #include "tables/table10.p4"
#endif


    apply{
        
        hdr.ts_ingress.setValid();
        hdr.ts_ingress.ts1 = ig_intr_md.ingress_mac_tstamp;
        hdr.ts_ingress.ts2 = ig_prsr_md.global_tstamp;

    #ifdef CHECK_T1
        if(t1.miss){
            drop();
        }
    #endif

    #ifdef WITH_T1
        t1.apply();
    #endif
    #ifdef WITH_T2
        t2.apply();
    #endif
    #ifdef WITH_T3
        t3.apply();
    #endif
    #ifdef WITH_T4
        t4.apply();
    #endif
    #ifdef WITH_T5
        t5.apply();
    #endif
    #ifdef WITH_T6
        t6.apply();
    #endif
    #ifdef WITH_T7
        t7.apply();
    #endif
    #ifdef WITH_T8
        t8.apply();
    #endif
    #ifdef WITH_T9
        t9.apply();
    #endif
    #ifdef WITH_T10
        t10.apply();
    #endif

    #ifdef CHECK_T1
        if(t1_lpm.miss){
            drop();
        }
    #endif

    #ifdef CHECK
        if(hdr.ipv4.isValid() && hdr.udp.isValid() && hdr.custom1.isValid() && hdr.custom2.isValid() && hdr.custom3.isValid() && hdr.custom4.isValid()){
            hdr.check.setValid();
            hdr.check.a = 0x12121212;
            hdr.check.b = 0x34343434;
            hdr.check.c = 0x56565656;
            hdr.check.d = 0x78787878;
        }
    #endif

    #ifdef STATIC_OUTPUT
        // static output port
        ig_tm_md.ucast_egress_port = (bit<9>)188;
    #endif

    }

}