Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ebpf/PSA: Support for wide fields in Digest #3877

Merged
merged 4 commits into from
Feb 27, 2023

Conversation

tatry
Copy link
Contributor

@tatry tatry commented Feb 6, 2023

This PR adds support for wide fields in Digest extern.

Also small refactor has been done - Digest implementation was placed in a separate file, like any other PSA externs.

CC: @osinstom

This commits adds support for wide fields in Digest extern.

Also small refactor has been done - Digest implementation was placed in
a separate file, like any other PSA externs.

class EBPFDigestPSAValueVisitor : public CodeGenInspector {
protected:
cstring digestMapInstance;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can't guess what this does based on the name.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've done small refactor and now instance of EBPFDigestPSA is used to push element to the queue instead of using this variable.

return false;
}

// handle expression like: "digest.pack(value)"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this the 'value' part in digest.pack?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've clarified this comment and other about these preorders

unsigned width = EBPFInitializerUtils::ebpfTypeWidth(typeMap, f->expression);
builder->emitIndent();

if (EBPFScalarType::generatesScalar(width)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder whether this code pattern shouldn't be some utility function.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added such function in CodeGenInspector which is used also in preorder(const IR::AssignmentStatement)

@tatry
Copy link
Contributor Author

tatry commented Feb 27, 2023

I would like to remind you to merge PR if it is looks good to you.

Only Mac OS tests fails, but they were broken at the time PR creation.

@fruffy fruffy merged commit dc70013 into p4lang:main Feb 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants