Skip to content

Commit

Permalink
Handle bfrt Info for new type (#3103)
Browse files Browse the repository at this point in the history
  • Loading branch information
kamleshbhalui authored Mar 3, 2022
1 parent 04b00f7 commit d1123b4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
6 changes: 1 addition & 5 deletions backends/dpdk/DpdkXfail.cmake
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
p4c_add_xfail_reason("dpdk"
"error: Error when generating BF-RT info for 'Digest' .*: packed type is too complex"
testdata/p4_16_samples/psa-example-digest-bmv2.p4
)

p4c_add_xfail_reason("dpdk"
"Expected packet length argument for"
testdata/p4_16_samples/psa-example-counters-bmv2.p4
Expand Down Expand Up @@ -46,6 +41,7 @@ p4c_add_xfail_reason("dpdk"

p4c_add_xfail_reason("dpdk"
"Unknown extern function"
testdata/p4_16_samples/psa-example-digest-bmv2.p4
testdata/p4_16_samples/psa-example-parser-checksum.p4
testdata/p4_16_samples/psa-meter6.p4
)
Expand Down
10 changes: 10 additions & 0 deletions control-plane/bfruntime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,16 @@ TypeSpecParser TypeSpecParser::make(const p4configv1::P4Info& p4info,
type = makeTypeBytes(fSpec.bitstring().varbit().max_bitwidth());
} else if (fSpec.has_bool_()) {
type = makeTypeBool(1);
} else if (fSpec.has_new_type()) {
auto newtypes = typeInfo.new_types();
auto typeName = fSpec.new_type().name();
auto newType = newtypes.find(typeName);
if (newType == newtypes.end()) {
::error("New type '%1%' not found in typeInfo for '%2%' '%3%'",
typeName, instanceType, instanceName);
return;
}
type = makeTypeBytes(newType->second.translated_type().sdn_bitwidth());
}

if (!type) {
Expand Down

0 comments on commit d1123b4

Please sign in to comment.