TNSM_Latency_Prediction / code / control / ingress / 2_custom / headers.p4
headers.p4
Raw
/*  Define all the headers the program will recognize             */
/*  The actual sets of headers processed by each gress can differ */


/*

 - Test keys [1 - 4]
 - Test key witdth [1,2,4,8,16,32,64,128,256]
 - Test match types [exact - lpm/ternary]
 - Test actions:
     - Set output port
     - Modify fields [1-10] - Same header, different headers.


*/


/*header ptp_metadata_t {
    bit<8>  udp_cksum_byte_offset;
    //1) Eth+IPv4+UDP = 42 bytes
    //2) Eth+MPLS+IPv4+UDP = 48 bytes
    //3) Eth+MPLS+IPv4+UDP+I_S+I_M = 64 bytes
    //4) Eth+MPLS+IPv4+UDP+I_S+I_M = 64 bytes
    bit<8>  cf_byte_offset;
    bit<48> updated_cf;
}*/

header ethernet_h {
    bit<48> dstAddr;
    bit<48> srcAddr;
    bit<16> etherType;
}//14 bytes

header ipv4_h {
    bit<4>    version;
    bit<4>    ihl;
    bit<6>    dscp;
    bit<2>    ecn;
    bit<16>   totalLen;
    bit<16>   identification;
    bit<3>    flags;
    bit<13>   fragOffset;
    bit<8>    ttl;
    bit<8>    protocol;
    bit<16>   hdrChecksum;
    ip4Addr_t srcAddr;
    ip4Addr_t dstAddr;
}//20 bytes

header ipv6_h {
    bit<4>    version;
    bit<8>    trafficClass;
    bit<20>   flowLabel;
    bit<16>   payloadLen;
    bit<8>    nextHdr;
    bit<8>    hopLimit;
    ip6Addr_t srcAddr;
    ip6Addr_t dstAddr;
} // 40 bytes

header tcp_h {
    bit<16> srcPort;
    bit<16> dstPort;
    bit<32> seqNo;
    bit<32> ackNo;
    bit<4>  dataOffset;
    bit<4>  res;
    bit<8>  flags;
    bit<16> window;
    bit<16> checksum;
    bit<16> urgentPtr;
}//20 bytes

header udp_h {
    bit<16> srcPort;
    bit<16> dstPort;
    bit<16> len;
    bit<16> checksum;
}//8 bytes

#include "headers_custom.p4"


/* Timestamping headers */
header timestamps_ingress_h {
    bit<48> ts2;
    bit<48> ts1;
} // 12 bytes

header timestamps_egress_h {
    bit<48> ts5;
    bit<24> ts4;
    bit<24> ts3;
} //12 bytes

#ifdef CHECK
    header check_h {
        bit<32> a;
        bit<32> b;
        bit<32> c;
        bit<32> d;
    }
#endif

/* TS6-related header */
/*
header ptp_metadata_t {
    bit<8>  udp_cksum_byte_offset;
    bit<8>  cf_byte_offset;
    bit<48> updated_cf;
}
*/

struct my_ingress_headers_t {
    ethernet_h            ethernet;
    timestamps_ingress_h  ts_ingress;
    ipv4_h                ipv4;
    ipv6_h                ipv6;
    tcp_h                 tcp;
    udp_h                 udp;
#ifdef CUSTOM_H1
    custom_h              custom1;
#endif
#ifdef CUSTOM_H2
    custom_h              custom2;
#endif
#ifdef CUSTOM_H3
    custom_h              custom3;
#endif
#ifdef CUSTOM_H4
    custom_h              custom4;
#endif
#ifdef CHECK
    check_h                 check;
#endif

}

struct my_egress_headers_t {
    ptp_metadata_t        ptp_metadata;
    ethernet_h            ethernet;
    timestamps_egress_h   ts_egress;
}