TNSM_Latency_Prediction / code / control / ingress / 1_test / 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 CHECK_T1

    action drop() {
        ig_dprsr_md.drop_ctl = 1;
    }
#endif


    table t1_lpm {
        key = {
            hdr.ipv4.dstAddr: lpm;
        }
        actions = {
            NoAction;
        }
    }

    table t2_lpm {
        key = {
            hdr.ipv4.dstAddr: lpm;
        }
        actions = {
            NoAction;
        }
    }

    table t3_lpm {
        key = {
            hdr.ipv4.dstAddr: lpm;
        }
        actions = {
            NoAction;
        }
    }

    table t4_lpm {
        key = {
            hdr.ipv4.dstAddr: lpm;
        }
        actions = {
            NoAction;
        }
    }

    table t5_lpm {
        key = {
            hdr.ipv4.dstAddr: lpm;
        }
        actions = {
            NoAction;
        }
    }

    table t6_lpm {
        key = {
            hdr.ipv4.dstAddr: lpm;
        }
        actions = {
            NoAction;
        }
    }

    table t7_lpm {
        key = {
            hdr.ipv4.dstAddr: lpm;
        }
        actions = {
            NoAction;
        }
    }
    
    table t8_lpm {
        key = {
            hdr.ipv4.dstAddr: lpm;
        }
        actions = {
            NoAction;
        }
    }

    table t9_lpm {
        key = {
            hdr.ipv4.dstAddr: lpm;
        }
        actions = {
            NoAction;
        }
    }

    table t10_lpm {
        key = {
            hdr.ipv4.dstAddr: lpm;
        }
        actions = {
            NoAction;
        }
    }


    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_lpm.miss){
            drop();
        }
    #endif

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

    }

}