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

DPDK Backend: Add support for tdi.json #3440

Merged
merged 3 commits into from
Jul 20, 2022
Merged

DPDK Backend: Add support for tdi.json #3440

merged 3 commits into from
Jul 20, 2022

Conversation

usha1830
Copy link
Contributor

Tdi json file needs to be emitted from p4c-dpdk to interface with the TDI .The contents of tdi json file is same as bfrt json with few additional program/environment related fields given below

{
"program_name" : "psa-example-mask-range",
  "build_date" : "Mon Jun 27 13:36:57 2022",
  "compile_command" : "./p4c-dpdk --arch psa -o test.spec ../testdata/p4_16_samples/psa-example-mask-range.p4 --bf-rt-schema bfrt.json --tdi tdi.json --p4runtime-files p4info.txt --context context.json",
  "compiler_version" : "0.1 (SHA: ad5b4a2d1 BUILD: RELEASE)",
  "schema_version" : "0.1",
  "target" : "DPDK",
<< bfrt json contents >>
}

Attached sample tdi json and corresponding bfrt json.
bfrt.json.txt
psa-example-mask-range.p4.txt
tdi.json.txt

json->emplace("build_date", cstring(options.getBuildDate()));
json->emplace("compile_command", cstring(options.getCompileCommand()));
json->emplace("compiler_version", cstring(options.compilerVersion));
json->emplace("schema_version", cstring("0.1"));
Copy link
Contributor

Choose a reason for hiding this comment

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

should this be a constant instead of a literal?

json->emplace("schema_version", cstring("0.1"));
json->emplace("target", cstring("DPDK"));
} else {
json->emplace("schema_version", cstring("1.0.0"));
Copy link
Contributor

Choose a reason for hiding this comment

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

this one as well

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Version strings can have more than one decimal point. So I think a string literal should be ok here.
Do you mean instead of string literal, we should use a const string type variable to hold the version string?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, a const string, in one place.

@usha1830
Copy link
Contributor Author

Some ptf-ebpf checks are failing. Not related to the changes in this PR.

@mihaibudiu mihaibudiu merged commit e524cb6 into p4lang:main Jul 20, 2022
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.

2 participants