Skip to content

Commit

Permalink
add clonecpu P4
Browse files Browse the repository at this point in the history
  • Loading branch information
xgr19 committed Mar 5, 2024
1 parent 333bd14 commit 38e6b2d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 12 deletions.
18 changes: 9 additions & 9 deletions Detection process/P4/command_p4.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ bfrt.simple_l3_test.pipe.Ingress.level2.node.add_with_CheckFeature(1, 1, 0,3,0,1
bfrt.simple_l3_test.pipe.Ingress.level2.node.add_with_CheckFeature(1, 1, 0,3,0,15,0,255,0,63,0,255,62,255, 0, 2, 0)
bfrt.simple_l3_test.pipe.Ingress.level2.node.add_with_CheckFeature(1, 0, 0,3,0,15,0,255,0,63,0,255,0,253, 0, 13, 1)
bfrt.simple_l3_test.pipe.Ingress.level2.node.add_with_CheckFeature(1, 0, 0,3,0,15,0,255,0,63,0,255,254,255, 0, 13, 0)
bfrt.simple_l3_test.pipe.Ingress.level3.node.add_with_SetClass(2, 1, 0, 3, 0, 15, 0, 255, 0, 63, 0, 255, 0, 255, 0, 3, 1)
bfrt.simple_l3_test.pipe.Ingress.level3.node.add_with_clone_to_cpu(2, 1, 0, 3, 0, 15, 0, 255, 0, 63, 0, 255, 0, 255, 0, 3, 1)
bfrt.simple_l3_test.pipe.Ingress.level3.node.add_with_CheckFeature(2, 0, 0,3,0,15,0,255,0,20,0,255,0,255, 0, 4, 1)
bfrt.simple_l3_test.pipe.Ingress.level3.node.add_with_CheckFeature(2, 0, 0,3,0,15,0,255,21,63,0,255,0,255, 0, 4, 0)
bfrt.simple_l3_test.pipe.Ingress.level3.node.add_with_SetClass(13, 1, 0, 3, 0, 15, 0, 255, 0, 63, 0, 255, 0, 255, 0, 14, 1)
bfrt.simple_l3_test.pipe.Ingress.level3.node.add_with_clone_to_cpu(13, 1, 0, 3, 0, 15, 0, 255, 0, 63, 0, 255, 0, 255, 0, 14, 1)
bfrt.simple_l3_test.pipe.Ingress.level3.node.add_with_CheckFeature(13, 0, 0,3,0,15,0,255,0,8,0,255,0,255, 0, 15, 1)
bfrt.simple_l3_test.pipe.Ingress.level3.node.add_with_CheckFeature(13, 0, 0,3,0,15,0,255,9,63,0,255,0,255, 0, 15, 0)
bfrt.simple_l3_test.pipe.Ingress.level4.node.add_with_CheckFeature(4, 1, 0,3,0,15,0,11,0,63,0,255,0,255, 0, 5, 1)
Expand All @@ -24,7 +24,7 @@ bfrt.simple_l3_test.pipe.Ingress.level4.node.add_with_CheckFeature(15, 0, 0,3,0,
bfrt.simple_l3_test.pipe.Ingress.level5.node.add_with_CheckFeature(5, 1, 0,3,0,15,0,255,0,63,0,255,0,62, 0, 6, 1)
bfrt.simple_l3_test.pipe.Ingress.level5.node.add_with_CheckFeature(5, 1, 0,3,0,15,0,255,0,63,0,255,63,255, 0, 6, 0)
bfrt.simple_l3_test.pipe.Ingress.level5.node.add_with_SetClass(5, 0, 0, 3, 0, 15, 0, 255, 0, 63, 0, 255, 0, 255, 0, 9, 192)
bfrt.simple_l3_test.pipe.Ingress.level5.node.add_with_SetClass(10, 1, 0, 3, 0, 15, 0, 255, 0, 63, 0, 255, 0, 255, 0, 11, 192)
bfrt.simple_l3_test.pipe.Ingress.level5.node.add_with_clone_to_cpu(10, 1, 0, 3, 0, 15, 0, 255, 0, 63, 0, 255, 0, 255, 0, 11, 192)
bfrt.simple_l3_test.pipe.Ingress.level5.node.add_with_SetClass(10, 0, 0, 3, 0, 15, 0, 255, 0, 63, 0, 255, 0, 255, 0, 12, 192)
bfrt.simple_l3_test.pipe.Ingress.level5.node.add_with_CheckFeature(16, 1, 0,0,0,15,0,255,0,63,0,255,0,255, 0, 17, 1)
bfrt.simple_l3_test.pipe.Ingress.level5.node.add_with_CheckFeature(16, 1, 1,3,0,15,0,255,0,63,0,255,0,255, 0, 17, 0)
Expand All @@ -33,20 +33,20 @@ bfrt.simple_l3_test.pipe.Ingress.level5.node.add_with_CheckFeature(25, 1, 0,3,0,
bfrt.simple_l3_test.pipe.Ingress.level5.node.add_with_CheckFeature(25, 1, 0,3,0,15,0,255,0,63,0,255,255,255, 0, 26, 0)
bfrt.simple_l3_test.pipe.Ingress.level5.node.add_with_CheckFeature(25, 0, 0,3,0,15,0,255,0,20,0,255,0,255, 0, 29, 1)
bfrt.simple_l3_test.pipe.Ingress.level5.node.add_with_CheckFeature(25, 0, 0,3,0,15,0,255,21,63,0,255,0,255, 0, 29, 0)
bfrt.simple_l3_test.pipe.Ingress.level6.node.add_with_SetClass(6, 1, 0, 3, 0, 15, 0, 255, 0, 63, 0, 255, 0, 255, 0, 7, 192)
bfrt.simple_l3_test.pipe.Ingress.level6.node.add_with_clone_to_cpu(6, 1, 0, 3, 0, 15, 0, 255, 0, 63, 0, 255, 0, 255, 0, 7, 192)
bfrt.simple_l3_test.pipe.Ingress.level6.node.add_with_SetClass(6, 0, 0, 3, 0, 15, 0, 255, 0, 63, 0, 255, 0, 255, 0, 8, 192)
bfrt.simple_l3_test.pipe.Ingress.level6.node.add_with_CheckFeature(17, 1, 0,3,0,15,0,255,0,63,0,255,0,254, 0, 18, 1)
bfrt.simple_l3_test.pipe.Ingress.level6.node.add_with_CheckFeature(17, 1, 0,3,0,15,0,255,0,63,0,255,255,255, 0, 18, 0)
bfrt.simple_l3_test.pipe.Ingress.level6.node.add_with_CheckFeature(17, 0, 0,3,0,15,0,255,0,63,0,255,0,254, 0, 21, 1)
bfrt.simple_l3_test.pipe.Ingress.level6.node.add_with_CheckFeature(17, 0, 0,3,0,15,0,255,0,63,0,255,255,255, 0, 21, 0)
bfrt.simple_l3_test.pipe.Ingress.level6.node.add_with_SetClass(26, 1, 0, 3, 0, 15, 0, 255, 0, 63, 0, 255, 0, 255, 0, 27, 192)
bfrt.simple_l3_test.pipe.Ingress.level6.node.add_with_clone_to_cpu(26, 1, 0, 3, 0, 15, 0, 255, 0, 63, 0, 255, 0, 255, 0, 27, 192)
bfrt.simple_l3_test.pipe.Ingress.level6.node.add_with_SetClass(26, 0, 0, 3, 0, 15, 0, 255, 0, 63, 0, 255, 0, 255, 0, 28, 192)
bfrt.simple_l3_test.pipe.Ingress.level6.node.add_with_SetClass(29, 1, 0, 3, 0, 15, 0, 255, 0, 63, 0, 255, 0, 255, 0, 30, 1)
bfrt.simple_l3_test.pipe.Ingress.level6.node.add_with_clone_to_cpu(29, 1, 0, 3, 0, 15, 0, 255, 0, 63, 0, 255, 0, 255, 0, 30, 1)
bfrt.simple_l3_test.pipe.Ingress.level6.node.add_with_CheckFeature(29, 0, 0,3,0,15,0,255,0,63,0,255,0,254, 0, 31, 1)
bfrt.simple_l3_test.pipe.Ingress.level6.node.add_with_CheckFeature(29, 0, 0,3,0,15,0,255,0,63,0,255,255,255, 0, 31, 0)
bfrt.simple_l3_test.pipe.Ingress.level7.node.add_with_SetClass(18, 1, 0, 3, 0, 15, 0, 255, 0, 63, 0, 255, 0, 255, 0, 19, 192)
bfrt.simple_l3_test.pipe.Ingress.level7.node.add_with_clone_to_cpu(18, 1, 0, 3, 0, 15, 0, 255, 0, 63, 0, 255, 0, 255, 0, 19, 192)
bfrt.simple_l3_test.pipe.Ingress.level7.node.add_with_SetClass(18, 0, 0, 3, 0, 15, 0, 255, 0, 63, 0, 255, 0, 255, 0, 20, 192)
bfrt.simple_l3_test.pipe.Ingress.level7.node.add_with_SetClass(21, 1, 0, 3, 0, 15, 0, 255, 0, 63, 0, 255, 0, 255, 0, 22, 192)
bfrt.simple_l3_test.pipe.Ingress.level7.node.add_with_clone_to_cpu(21, 1, 0, 3, 0, 15, 0, 255, 0, 63, 0, 255, 0, 255, 0, 22, 192)
bfrt.simple_l3_test.pipe.Ingress.level7.node.add_with_SetClass(21, 0, 0, 3, 0, 15, 0, 255, 0, 63, 0, 255, 0, 255, 0, 23, 192)
bfrt.simple_l3_test.pipe.Ingress.level7.node.add_with_SetClass(31, 1, 0, 3, 0, 15, 0, 255, 0, 63, 0, 255, 0, 255, 0, 32, 192)
bfrt.simple_l3_test.pipe.Ingress.level7.node.add_with_clone_to_cpu(31, 1, 0, 3, 0, 15, 0, 255, 0, 63, 0, 255, 0, 255, 0, 32, 192)
bfrt.simple_l3_test.pipe.Ingress.level7.node.add_with_SetClass(31, 0, 0, 3, 0, 15, 0, 255, 0, 63, 0, 255, 0, 255, 0, 33, 192)
13 changes: 10 additions & 3 deletions Detection process/P4/simple_l3_test.p4
Original file line number Diff line number Diff line change
Expand Up @@ -166,15 +166,22 @@ control Level(inout my_ingress_headers_t hdr,
//meta.flag=2;
}

action SetClass(bit<16> node_id, bit<8> class_id) {
meta.class_id = class_id;
action SetBenign(bit<16> node_id, bit<8> class_id) {
meta.class_id = class_id; // cls = 0
meta.prev_node_id = node_id;
ig_tm_md.ucast_egress_port = (bit<9>)class_id; // for debug

//hdr.extra_info.setInvalid();
//meta.flag=1;
exit;
}

action clone_to_cpu(bit<16> node_id, bit<8> class_id){
meta.class_id = class_id; // cls = 1
meta.prev_node_id = node_id;
ig_tm_md.copy_to_cpu = 0x1;
exit;
}

table node {
key = {
Expand All @@ -199,7 +206,7 @@ control Level(inout my_ingress_headers_t hdr,
//meta.flag[2:2]:ternary; // RST
// meta.flag[0:0]:; // FIN
}
actions = {CheckFeature; SetClass;}
actions = {CheckFeature; SetBenign; clone_to_cpu;}
size = node_size;
}

Expand Down

0 comments on commit 38e6b2d

Please sign in to comment.