Skip to content

P4TC - Convert all variables during the arithmetic operation to network order and avoid converting header fields in parser and deparser to host order to increase performance. #4234

@komaljai

Description

@komaljai

We can avoid extra computational cycles in coverting header fields from network to host in parser and host to network in deparser. Everytime we do, for example, a comparison between header fields and a value, we should convert that value to network order. For example, something like comparing the ether type should to see if it's IP should do the following:

select_0 = hdr->ethernet.etherType;
if (select_0 == htons(0x800))goto parse_ipv4;

Since hdr->ethernet.etherType is in big endian.
We are using comparison as an example, but this applies to all arithmetic/logical operations where we have a header and another value that is in host endian.

Metadata

Metadata

Assignees

Labels

p4tcTopics related to the P4-TC back end. On PRs, also triggers p4tc CI tests to run.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions