From 35d824b7f3c2b92b9f98974726762f55918e87e7 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 10 Jul 2019 22:47:52 +0200 Subject: [PATCH] ++netpfga --- p4src/action_netpfga_dummy.p4 | 25 +++++++++++++++++++++++++ p4src/commands.txt | 3 +++ p4src/minip4_solution-nat64.p4 | 19 +------------------ 3 files changed, 29 insertions(+), 18 deletions(-) create mode 100644 p4src/action_netpfga_dummy.p4 create mode 100644 p4src/commands.txt diff --git a/p4src/action_netpfga_dummy.p4 b/p4src/action_netpfga_dummy.p4 new file mode 100644 index 0000000..01522cf --- /dev/null +++ b/p4src/action_netpfga_dummy.p4 @@ -0,0 +1,25 @@ +#ifndef DUMMY_NETPFGA +#define DUMMY_NETPFGA + +action do_nothing() { + +} +action send_to_port1() { + sume_metadata.dst_port = 1; +} + +table dummy_table_for_netpfga { + key = { + hdr.ethernet.dst_addr: exact; + } + + actions = { + do_nothing; + send_to_port1; + } + size = TEST_TABLE_SIZE; + default_action = do_nothing; + +} + +#endif \ No newline at end of file diff --git a/p4src/commands.txt b/p4src/commands.txt new file mode 100644 index 0000000..80126f9 --- /dev/null +++ b/p4src/commands.txt @@ -0,0 +1,3 @@ +// only used on netpfga for dummy packet reply + +table_cam_add_entry dummy_table_for_netpfga send_to_port1 0x00000000 => 0x00000001 diff --git a/p4src/minip4_solution-nat64.p4 b/p4src/minip4_solution-nat64.p4 index 86ca1dc..5d584c0 100644 --- a/p4src/minip4_solution-nat64.p4 +++ b/p4src/minip4_solution-nat64.p4 @@ -70,25 +70,8 @@ control TopPipe(inout headers hdr, #endif } - table dummy_table_for_netpfga { - key = { - hdr.ethernet.dst_addr: exact; - } - - actions = { - swap_eth_addresses; - do_nothing; - send_to_port1; -// send_to_all_ports; - } - size = TEST_TABLE_SIZE; -// default_action = swap_eth_addresses; // test_mirror(): in gen_testdata.py - default_action = send_to_port1; // test_port1() -// default_action = send_to_all_ports; // test_allports(): - } - apply { - lookup_table.apply(); + dummy_table_for_netpfga.apply(); } }