From 01664d3f589d07406a9ee09200376e4c22888948 Mon Sep 17 00:00:00 2001 From: Guy Davidi <64970907+guy-davidi@users.noreply.github.com> Date: Tue, 24 Jan 2023 21:39:41 +0200 Subject: [PATCH 1/7] Update Readme Co-authored-by: DavidisP4 Co-authored-by: guy-davidi --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 6d40945..e1aab8f 100644 --- a/README.md +++ b/README.md @@ -1 +1,2 @@ -# DPDK-scripts \ No newline at end of file +# DPDK-scripts +Here will load scripts From a80903c8f966e236a2603ea9f6362c885d26177e Mon Sep 17 00:00:00 2001 From: DavidisP4 <122877251+DavidisP4@users.noreply.github.com> Date: Tue, 24 Jan 2023 21:59:18 +0200 Subject: [PATCH 2/7] Update README.md --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index e1aab8f..7f2d7fd 100644 --- a/README.md +++ b/README.md @@ -1,2 +1 @@ # DPDK-scripts -Here will load scripts From 2556dd529455b6e816c218a57644773431fe227f Mon Sep 17 00:00:00 2001 From: Guy Davidi <64970907+guy-davidi@users.noreply.github.com> Date: Tue, 24 Jan 2023 22:03:01 +0200 Subject: [PATCH 3/7] Update README.md --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index e1aab8f..7f2d7fd 100644 --- a/README.md +++ b/README.md @@ -1,2 +1 @@ # DPDK-scripts -Here will load scripts From 85b3458ff6dec355c8c34f4618a5346b883610a4 Mon Sep 17 00:00:00 2001 From: Guy Davidi <64970907+guy-davidi@users.noreply.github.com> Date: Tue, 24 Jan 2023 22:05:44 +0200 Subject: [PATCH 4/7] Add .P4 Add .P4 --- sample.p4 | 140 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 140 insertions(+) create mode 100644 sample.p4 diff --git a/sample.p4 b/sample.p4 new file mode 100644 index 0000000..84f29c3 --- /dev/null +++ b/sample.p4 @@ -0,0 +1,140 @@ +/* +Copyright 2019 RT-RK Computer Based Systems. +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + + +#include +#include + +const bit<16> TYPE_IPV4 = 0x800; + +typedef bit<9> egressSpec_t; +typedef bit<48> macAddr_t; +typedef bit<32> ip4Addr_t; + +enum X { + Field_0, + Field_1, + Field_2 +} + +enum Y { + Field_00, + Field_01, + Field_02 +} + +header ethernet_t { + macAddr_t dstAddr; + macAddr_t srcAddr; + bit<16> etherType; +} + +header ipv4_t { + bit<4> version; + bit<4> ihl; + bit<8> diffserv; + 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; +} + +struct metadata { + /* empty */ +} + +struct headers { + ethernet_t ethernet; + ipv4_t ipv4; +} + +parser MyParser(packet_in packet, + out headers hdr, + inout metadata meta, + inout standard_metadata_t standard_metadata) { + + state start { + transition accept; + } + +} + +control MyVerifyChecksum(inout headers hdr, inout metadata meta) { + apply { } +} + +control MyIngress(inout headers hdr, + inout metadata meta, + inout standard_metadata_t standard_metadata) { + action drop() { + mark_to_drop(standard_metadata); + } + action ipv4_forward(macAddr_t dstAddr, egressSpec_t port) { + X tmp = X.Field_0; + Y tmp2 = Y.Field_00; + if (tmp == X.Field_0){ + if (tmp2 == Y.Field_00){ + standard_metadata.egress_spec = port; + hdr.ethernet.srcAddr = hdr.ethernet.dstAddr; + hdr.ethernet.dstAddr = dstAddr; + hdr.ipv4.ttl = hdr.ipv4.ttl - 1; + } + } + } + table ipv4_lpm { + key = { + hdr.ipv4.dstAddr: lpm; + } + actions = { + ipv4_forward; + drop; + NoAction; + } + size = 1024; + default_action = drop(); + } + apply { + if (hdr.ipv4.isValid()) { + ipv4_lpm.apply(); + } + } +} + + +control MyEgress(inout headers hdr, + inout metadata meta, + inout standard_metadata_t standard_metadata) { + apply { } +} + +control MyComputeChecksum(inout headers hdr, inout metadata meta) { + apply { } +} + +control MyDeparser(packet_out packet, in headers hdr) { + apply { } +} + +V1Switch( +MyParser(), +MyVerifyChecksum(), +MyIngress(), +MyEgress(), +MyComputeChecksum(), +MyDeparser() +) main; From cc41bbc87fed672912f1656227979805f58d2090 Mon Sep 17 00:00:00 2001 From: Guy Davidi <64970907+guy-davidi@users.noreply.github.com> Date: Fri, 27 Jan 2023 10:04:39 +0200 Subject: [PATCH 5/7] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 7f2d7fd..cac54ff 100644 --- a/README.md +++ b/README.md @@ -1 +1,2 @@ # DPDK-scripts +done 1 From e637dc89da7ca861ed52f225a95e63ba5988c2a4 Mon Sep 17 00:00:00 2001 From: Guy Davidi <64970907+guy-davidi@users.noreply.github.com> Date: Fri, 27 Jan 2023 10:04:50 +0200 Subject: [PATCH 6/7] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index cac54ff..5ac449d 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,2 @@ # DPDK-scripts -done 1 +done 1.1 From e71b540715c70374fc21cf3005ef8001950e5a26 Mon Sep 17 00:00:00 2001 From: Guy Davidi <64970907+guy-davidi@users.noreply.github.com> Date: Fri, 27 Jan 2023 10:05:45 +0200 Subject: [PATCH 7/7] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5ac449d..da9ec6f 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,2 @@ # DPDK-scripts -done 1.1 +done 1.2