Skip to content

support to check SAI capability of ACL META_DATA fields#3274

Closed
siqbal1986 wants to merge 10 commits intosonic-net:masterfrom
siqbal1986:dscp_acl_1
Closed

support to check SAI capability of ACL META_DATA fields#3274
siqbal1986 wants to merge 10 commits intosonic-net:masterfrom
siqbal1986:dscp_acl_1

Conversation

@siqbal1986
Copy link
Contributor

What I did
Added support to check if the platform supports the following SAI attributes.
This changes also gets the platform supported range for matadata value.
SAI_SWITCH_ATTR_ACL_USER_META_DATA_RANGE
SAI_ACL_ENTRY_ATTR_ACTION_SET_ACL_META_DATA
SAI_ACL_ENTRY_ATTR_FIELD_ACL_USER_META

Why I did it
For ACL outer DSCP change feature, these attributes are required.

How I verified it
Basic verification done in VS enviornment

Aug 23 23:13:37.191745 0066f13dd278 WARNING #orchagent: :- init: Could not get range for ACL_USER_META_DATA_RANGE -15
Aug 23 23:13:37.191756 0066f13dd278 NOTICE #orchagent: :- init: ACL_USER_META_DATA_RANGE capability 1
Aug 23 23:13:37.192269 0066f13dd278 NOTICE #orchagent: :- init: ACL_ENTRY_ATTR_FIELD_ACL_USER_META capability 1
Aug 23 23:13:37.192705 0066f13dd278 NOTICE #orchagent: :- init: ACL_ENTRY_ATTR_ACTION_SET_ACL_META_DATA capability 1
Mlnx 2700 T1
image

Details if related

    SAI_SWITCH_ATTR_ACL_USER_META_DATA_RANGE
    SAI_ACL_ENTRY_ATTR_ACTION_SET_ACL_META_DATA
    SAI_ACL_ENTRY_ATTR_FIELD_ACL_USER_META
bingwang-ms
bingwang-ms previously approved these changes Oct 3, 2024
// SWSS_LOG_WARN("Could not query ACL_USER_META_DATA_RANGE %d", status);
// }
// else
if (status == SAI_STATUS_SUCCESS)
Copy link
Contributor

Choose a reason for hiding this comment

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

The code commented out is required. Is there any other way to resolve the code coverage issue?

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 have not found a way to resolve this by other means. This is initialization code. The Vs environment does not populate these. There are VS tests in the 2nd PR which cover these values.

Copy link
Contributor

Choose a reason for hiding this comment

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

If it can't be covered by UT in anyways, can you try to bypass the check as it's a test issue? It doesn't make sense to remove feature code for UT coverage.

Copy link
Contributor

Choose a reason for hiding this comment

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

@prsunny Can you please comment?

Copy link
Collaborator

Choose a reason for hiding this comment

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

agree, please refer to other PRs with capability query support added

}
// The following lines would be replaced in the next PR where these values would be used to initialze the metadataMgr.
(void)metadataMin;
(void)metadataMax;
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we remove these two variables if they are not used?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

They are used in the 2nd PR. which #3307.

Copy link
Contributor

Choose a reason for hiding this comment

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

Then can we add these variables in the 2nd PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

the 2nd PR is a child of this PR. In an effort to make the review easier, I created this PR first. the 2nd PR branch is a child of this branch. once this goes in, it would use these variables.


if (platform == VS_PLATFORM_SUBSTRING)
{
// For testing on VS the following values will be used.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please dont use magic numbers


status = sai_query_attribute_capability(gSwitchId, SAI_OBJECT_TYPE_SWITCH, SAI_SWITCH_ATTR_ACL_USER_META_DATA_RANGE, &capability);
// Disabling these blocks to stop coverage analysis failure. The subsequent PR will enable these.
// if (status != SAI_STATUS_SUCCESS)
Copy link
Collaborator

Choose a reason for hiding this comment

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

No commented code per guidelines

// SWSS_LOG_WARN("Could not query ACL_USER_META_DATA_RANGE %d", status);
// }
// else
if (status == SAI_STATUS_SUCCESS)
Copy link
Collaborator

Choose a reason for hiding this comment

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

agree, please refer to other PRs with capability query support added

attrs[0].id = SAI_SWITCH_ATTR_ACL_USER_META_DATA_RANGE;
sai_status_t status = sai_switch_api->get_switch_attribute(gSwitchId, 2, attrs);
// Disabling these blocks to stop coverage analysis failure. The subsequent PR will enable these.
// if (status != SAI_STATUS_SUCCESS)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same here. no commented code. I think this PR is still in draft state

SWSS_LOG_NOTICE("ACL_ENTRY_ATTR_ACTION_SET_ACL_META_DATA capability %d", capability.set_implemented);
}
// The following lines would be replaced in the next PR where these values would be used to initialze the metadataMgr.
(void)metadataMin;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Remove unused params. This can also fail the coverage.

@siqbal1986
Copy link
Contributor Author

closing this PR. Please review #3307 as the changes are merged there.

@siqbal1986 siqbal1986 closed this Oct 24, 2024
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