Integrate existing headers
This commit is contained in:
parent
1177008608
commit
49e1f511b0
2 changed files with 13 additions and 10 deletions
0
netpfga/minip4/simple_sume_switch/bitfiles/program_switch.sh
Normal file → Executable file
0
netpfga/minip4/simple_sume_switch/bitfiles/program_switch.sh
Normal file → Executable file
|
@ -9,7 +9,10 @@
|
|||
// bit<16> etherType;
|
||||
// }
|
||||
|
||||
typedef struct headers Parsed_packet;
|
||||
//typedef struct headers Parsed_packet;
|
||||
|
||||
#define Parsed_packet headers
|
||||
#define user_metadata_t metadata
|
||||
|
||||
//struct Parsed_packet {
|
||||
// Ethernet_h ethernet;
|
||||
|
@ -17,9 +20,9 @@ typedef struct headers Parsed_packet;
|
|||
|
||||
// user defined metadata: can be used to share information between
|
||||
// TopParser, TopPipe, and TopDeparser
|
||||
struct user_metadata_t {
|
||||
bit<8> unused;
|
||||
}
|
||||
//struct user_metadata_t {
|
||||
// bit<8> unused;
|
||||
//}
|
||||
|
||||
// digest_data, MUST be 256 bits -- what is this used for?
|
||||
struct digest_data_t {
|
||||
|
@ -38,7 +41,7 @@ parser RealParser(
|
|||
|
||||
state start {
|
||||
packet.extract(hdr.ethernet);
|
||||
meta.unused = 0;
|
||||
// meta.unused = 0;
|
||||
digest_data.unused = 0;
|
||||
transition accept;
|
||||
}
|
||||
|
@ -73,9 +76,9 @@ control RealMain(
|
|||
#include "actions_nat64_generic.p4"
|
||||
|
||||
action swap_eth_addresses() {
|
||||
EthAddr_t temp = hdr.ethernet.dstAddr;
|
||||
hdr.ethernet.dstAddr = hdr.ethernet.srcAddr;
|
||||
hdr.ethernet.srcAddr = temp;
|
||||
mac_addr_t temp = hdr.ethernet.dst_addr;
|
||||
hdr.ethernet.dst_addr = hdr.ethernet.src_addr;
|
||||
hdr.ethernet.src_addr = temp;
|
||||
|
||||
/* set egress port */
|
||||
sume_metadata.dst_port = sume_metadata.src_port;
|
||||
|
@ -98,12 +101,12 @@ control RealMain(
|
|||
}
|
||||
|
||||
action do_nothing() {
|
||||
EthAddr_t temp = hdr.ethernet.dstAddr;
|
||||
mac_addr_t temp = hdr.ethernet.dst_addr;
|
||||
}
|
||||
|
||||
table lookup_table {
|
||||
key = {
|
||||
hdr.ethernet.dstAddr: exact;
|
||||
hdr.ethernet.dst_addr: exact;
|
||||
}
|
||||
|
||||
actions = {
|
||||
|
|
Loading…
Reference in a new issue