Skip to content

Commit

Permalink
Support P4Runtime annotations for match keys. Fixes #463.
Browse files Browse the repository at this point in the history
  • Loading branch information
sethfowler committed Apr 17, 2017
1 parent 91cca2b commit ca9d25b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion control-plane/p4RuntimeSerializer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,8 @@ struct MatchField {
const cstring name; // The fully qualified external name of this field.
const MatchType type; // The match algorithm - exact, ternary, range, etc.
const uint32_t bitwidth; // How wide this field is.
const IR::IAnnotated* annotations; // If non-null, any annotations applied
// to this field.
};

/// The types of action profiles available in the V1 model.
Expand Down Expand Up @@ -1017,6 +1019,7 @@ class P4RuntimeSerializer {
auto match_field = table->add_match_fields();
match_field->set_id(index++);
match_field->set_name(field.name);
addAnnotations(match_field, field.annotations);
match_field->set_bitwidth(field.bitwidth);
match_field->set_match_type(field.type);
}
Expand Down Expand Up @@ -1333,7 +1336,8 @@ getMatchFields(const IR::P4Table* table, ReferenceMap* refMap, TypeMap* typeMap)
}

matchFields.push_back(MatchField{path->serialize(), matchType,
uint32_t(path->type->width_bits())});
uint32_t(path->type->width_bits()),
keyElement->to<IR::IAnnotated>()});
}

return matchFields;
Expand Down

0 comments on commit ca9d25b

Please sign in to comment.