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

[libsai] Re-implement APIs create/remove #653

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

jimmyzhai
Copy link
Collaborator

@jimmyzhai jimmyzhai commented Dec 19, 2024

Following #651, refactor APIs create/remove for easier read and maintenance:

  1. Use common code DashSai::create and DashSai::remove to implement them for all SAI objects/entries
  2. Fix issue Why dash_sai_create_dash_acl_rule create multiple SAI_OBJECT_TYPE_DASH_ACL_RULE objects? #436
  3. Fix issue Per-action parameter support in dash libsai #654

The generated sample code of APIs create/remove attribute is as below:

  • SAI object objectID
    image

  • SAI object entry
    image

@mssonicbld
Copy link

/azp run

Copy link

Commenter does not have sufficient privileges for PR 653 in repo sonic-net/DASH

@jimmyzhai jimmyzhai force-pushed the libsai_create_remove branch from d7f18a9 to 28dabbe Compare December 19, 2024 13:53
@mssonicbld
Copy link

/azp run

Copy link

Commenter does not have sufficient privileges for PR 653 in repo sonic-net/DASH

@mssonicbld
Copy link

/azp run

Copy link

Commenter does not have sufficient privileges for PR 653 in repo sonic-net/DASH

@jimmyzhai jimmyzhai force-pushed the libsai_create_remove branch from 5c2bc0b to 6b8b884 Compare December 20, 2024 13:48
@mssonicbld
Copy link

/azp run

Copy link

Commenter does not have sufficient privileges for PR 653 in repo sonic-net/DASH

@jimmyzhai jimmyzhai force-pushed the libsai_create_remove branch from 6b8b884 to 8b334c3 Compare December 20, 2024 14:45
@mssonicbld
Copy link

/azp run

Copy link

Commenter does not have sufficient privileges for PR 653 in repo sonic-net/DASH

@jimmyzhai jimmyzhai marked this pull request as ready for review December 20, 2024 15:42
@jimmyzhai jimmyzhai requested review from kcudnik and r12f December 20, 2024 15:42
Comment on lines 27 to 37
{
for (auto i=0u; i<keys.size(); i++) {
if (key_name == keys[i].name) {
return &keys[i];
}
}

Copy link
Collaborator

Choose a reason for hiding this comment

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

over entire PR incosistent placemtn { once in end of function once in new line, over all project has { in new line

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

fixed

get_attr_value_from_p4(key.field, key.bitwidth, mf_optional, value);
}
else {
assert(0);
Copy link
Collaborator

Choose a reason for hiding this comment

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

some error message would be nice

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

fixed

}
else if (field == "u64") {
uint64_t val = *(const uint64_t*)v;
if (*reinterpret_cast<const char*>("\0\x01") == 0) { // Little Endian
Copy link
Collaborator

Choose a reason for hiding this comment

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

what is that ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

A quick approach to checking host arch endianness, from https://github.com/sonic-net/DASH/blob/main/dash-pipeline/SAI/src/utils.h#L143.

Copy link
Collaborator

Choose a reason for hiding this comment

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

please don't use that, use proper macros/functions defined endian.h? and make proper function for that if you need running time host endian

@jimmyzhai jimmyzhai force-pushed the libsai_create_remove branch from 8b334c3 to 93e8cca Compare December 24, 2024 16:23
@mssonicbld
Copy link

/azp run

Copy link

Commenter does not have sufficient privileges for PR 653 in repo sonic-net/DASH

@mssonicbld
Copy link

/azp run

Copy link

Commenter does not have sufficient privileges for PR 653 in repo sonic-net/DASH

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