Skip to content

Commit

Permalink
[P4_Symbolic] Eliminate symbolic::TableEntry and use ir::TableEntry i…
Browse files Browse the repository at this point in the history
…nstead. (sonic-net#976)

Co-authored-by: VSuryaprasad-HCL <[email protected]>
  • Loading branch information
ksravani-hcl and VSuryaprasad-HCL authored Feb 6, 2025
1 parent 04f2265 commit ac6e15a
Show file tree
Hide file tree
Showing 21 changed files with 879 additions and 836 deletions.
4 changes: 4 additions & 0 deletions p4_symbolic/ir/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ cc_library(
"@com_google_absl//absl/container:btree",
"@com_google_absl//absl/status",
"@com_google_absl//absl/status:statusor",
"@com_google_absl//absl/strings",
"@com_google_absl//absl/types:span",
],
)
Expand Down Expand Up @@ -93,12 +94,15 @@ cc_library(
":ir_cc_proto",
":table_entries",
"//gutil:status",
"//p4_pdpi:ir_cc_proto",
"//p4_symbolic/bmv2:bmv2_cc_proto",
"@com_github_google_glog//:glog",
"@com_google_absl//absl/container:btree",
"@com_google_absl//absl/container:node_hash_map",
"@com_google_absl//absl/status",
"@com_google_absl//absl/status:statusor",
"@com_google_absl//absl/strings",
"@com_google_protobuf//:protobuf",
],
)

Expand Down
163 changes: 87 additions & 76 deletions p4_symbolic/ir/expected/basic.txt
Original file line number Diff line number Diff line change
Expand Up @@ -801,114 +801,125 @@ deparsers {
=====MyIngress.ipv4_lpm Entries=====

concrete_entry {
table_name: "MyIngress.ipv4_lpm"
matches {
name: "hdr.ipv4.dstAddr"
lpm {
value {
ipv4: "10.10.0.0"
pdpi_ir_entry {
table_name: "MyIngress.ipv4_lpm"
matches {
name: "hdr.ipv4.dstAddr"
lpm {
value {
ipv4: "10.10.0.0"
}
prefix_length: 16
}
prefix_length: 16
}
}
action {
name: "MyIngress.ipv4_forward"
params {
name: "dstAddr"
value {
hex_str: "0x000000000000"
action {
name: "MyIngress.ipv4_forward"
params {
name: "dstAddr"
value {
hex_str: "0x000000000000"
}
}
}
params {
name: "port"
value {
hex_str: "0x000"
params {
name: "port"
value {
hex_str: "0x000"
}
}
}
}
}

concrete_entry {
table_name: "MyIngress.ipv4_lpm"
matches {
name: "hdr.ipv4.dstAddr"
lpm {
value {
ipv4: "10.10.0.0"
pdpi_ir_entry {
table_name: "MyIngress.ipv4_lpm"
matches {
name: "hdr.ipv4.dstAddr"
lpm {
value {
ipv4: "10.10.0.0"
}
prefix_length: 32
}
prefix_length: 32
}
}
action {
name: "MyIngress.ipv4_forward"
params {
name: "dstAddr"
value {
hex_str: "0x000000000000"
action {
name: "MyIngress.ipv4_forward"
params {
name: "dstAddr"
value {
hex_str: "0x000000000000"
}
}
}
params {
name: "port"
value {
hex_str: "0x001"
params {
name: "port"
value {
hex_str: "0x001"
}
}
}
}
index: 1
}

concrete_entry {
table_name: "MyIngress.ipv4_lpm"
matches {
name: "hdr.ipv4.dstAddr"
lpm {
value {
ipv4: "10.0.0.0"
pdpi_ir_entry {
table_name: "MyIngress.ipv4_lpm"
matches {
name: "hdr.ipv4.dstAddr"
lpm {
value {
ipv4: "10.0.0.0"
}
prefix_length: 8
}
prefix_length: 8
}
}
action {
name: "MyIngress.ipv4_forward"
params {
name: "dstAddr"
value {
hex_str: "0x00000000000a"
action {
name: "MyIngress.ipv4_forward"
params {
name: "dstAddr"
value {
hex_str: "0x00000000000a"
}
}
}
params {
name: "port"
value {
hex_str: "0x001"
params {
name: "port"
value {
hex_str: "0x001"
}
}
}
}
index: 2
}

concrete_entry {
table_name: "MyIngress.ipv4_lpm"
matches {
name: "hdr.ipv4.dstAddr"
lpm {
value {
ipv4: "20.20.0.0"
pdpi_ir_entry {
table_name: "MyIngress.ipv4_lpm"
matches {
name: "hdr.ipv4.dstAddr"
lpm {
value {
ipv4: "20.20.0.0"
}
prefix_length: 16
}
prefix_length: 16
}
}
action {
name: "MyIngress.ipv4_forward"
params {
name: "dstAddr"
value {
hex_str: "0x160000000016"
action {
name: "MyIngress.ipv4_forward"
params {
name: "dstAddr"
value {
hex_str: "0x160000000016"
}
}
}
params {
name: "port"
value {
hex_str: "0x001"
params {
name: "port"
value {
hex_str: "0x001"
}
}
}
}
index: 3
}

53 changes: 29 additions & 24 deletions p4_symbolic/ir/expected/table.txt
Original file line number Diff line number Diff line change
Expand Up @@ -420,40 +420,45 @@ deparsers {
=====MyIngress.ports_exact Entries=====

concrete_entry {
table_name: "MyIngress.ports_exact"
matches {
name: "standard_metadata.ingress_port"
exact {
hex_str: "0x000"
pdpi_ir_entry {
table_name: "MyIngress.ports_exact"
matches {
name: "standard_metadata.ingress_port"
exact {
hex_str: "0x000"
}
}
}
action {
name: "MyIngress.set_egress_spec"
params {
name: "port"
value {
hex_str: "0x001"
action {
name: "MyIngress.set_egress_spec"
params {
name: "port"
value {
hex_str: "0x001"
}
}
}
}
}

concrete_entry {
table_name: "MyIngress.ports_exact"
matches {
name: "standard_metadata.ingress_port"
exact {
hex_str: "0x001"
pdpi_ir_entry {
table_name: "MyIngress.ports_exact"
matches {
name: "standard_metadata.ingress_port"
exact {
hex_str: "0x001"
}
}
}
action {
name: "MyIngress.set_egress_spec"
params {
name: "port"
value {
hex_str: "0x000"
action {
name: "MyIngress.set_egress_spec"
params {
name: "port"
value {
hex_str: "0x000"
}
}
}
}
index: 1
}

Loading

0 comments on commit ac6e15a

Please sign in to comment.