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

[vslib]: Add MACsec state to state base #722

Merged
merged 8 commits into from
Dec 13, 2020

Conversation

Pterosaur
Copy link
Contributor

Signed-off-by: Ze Gan ganze718@gmail.com

Signed-off-by: Ze Gan <ganze718@gmail.com>
@@ -249,6 +250,12 @@ namespace saivs
_In_ const std::string &serializedObjectId,
_In_ const sai_attribute_t* attr);

virtual sai_status_t get_internal(
Copy link
Collaborator

Choose a reason for hiding this comment

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

please remove, no need for get internal function

Comment on lines 696 to 713
if (objectType == SAI_OBJECT_TYPE_MACSEC_SA)
{
return getMACsecSAAttr(
serializedObjectId,
attr_count,
attr_list);
}

if (objectType == SAI_OBJECT_TYPE_MACSEC)
{
return getMACsecAttr(
serializedObjectId,
attr_count,
attr_list);
}

return get_internal(objectType, serializedObjectId, attr_count, attr_list);
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

please remove get_inernal function, there are no special action needed for GET, those attributes SAI_MACSEC_ATTR_SCI_IN_INGRESS_MACSEC_ACL you are referring, are READ_ONLY and should be refressed in "status = refresh_read_only(meta, oid);" function internals

Copy link
Collaborator

Choose a reason for hiding this comment

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

SAI_MACSEC_SA_ATTR_XPN should be set during CREATE, since it's create and set attribute, so get will work fine for this attribute, same for SAI_MACSEC_SA_ATTR_MINIMUM_XPN, those attributes have default values, but they are not set, when object is created, probably you should set them on custom create function

Copy link
Collaborator

Choose a reason for hiding this comment

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

those 2 functions getMACsecSAAttr getMACsecAttr can be removed

Signed-off-by: Ze Gan <ganze718@gmail.com>
@lgtm-com
Copy link

lgtm-com bot commented Dec 1, 2020

This pull request introduces 1 alert when merging 26acb46 into 6dfad66 - view on LGTM.com

new alerts:

  • 1 for Comparison result is always the same

@kcudnik
Copy link
Collaborator

kcudnik commented Dec 1, 2020

can you check LGTM warnings ?

Signed-off-by: Ze Gan <ganze718@gmail.com>
Signed-off-by: Ze Gan <ganze718@gmail.com>
@lgtm-com
Copy link

lgtm-com bot commented Dec 1, 2020

This pull request introduces 1 alert when merging ea49bd9 into 6dfad66 - view on LGTM.com

new alerts:

  • 1 for Comparison result is always the same

Signed-off-by: Ze Gan <ganze718@gmail.com>
@Pterosaur Pterosaur marked this pull request as ready for review December 4, 2020 04:30
Signed-off-by: Ze Gan <ganze718@gmail.com>
@lgtm-com
Copy link

lgtm-com bot commented Dec 4, 2020

This pull request introduces 1 alert when merging 582a5ac into d814d2c - view on LGTM.com

new alerts:

  • 1 for Comparison result is always the same

@@ -818,7 +818,7 @@ size_t MACsecManager::get_macsec_sa_count(

size_t sa_count = 0;

for (macsec_an_t an = 0; an <= MAX_MACSEC_SA_NUMBER; an++)
for (macsec_an_t an = 0; an <= MAX_MACSEC_SA_NUMBER; an++) // lgtm [cpp/constant-comparison]
Copy link
Collaborator

Choose a reason for hiding this comment

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

can't figure out why this is alert ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I cannot understand why it's an alert. Maybe it's a false positive, I guess.

sai_status_t SwitchStateBase::getMACsecSAAttr(
_In_ const std::string &serializedObjectId,
_In_ uint32_t attrCount,
_Out_ sai_attribute_t *attrList)
{
SWSS_LOG_ENTER();

CHECK_STATUS(get_internal(SAI_OBJECT_TYPE_MACSEC_SA, serializedObjectId, attrCount, attrList));
CHECK_STATUS(get(SAI_OBJECT_TYPE_MACSEC_SA, serializedObjectId, attrCount, attrList));
Copy link
Collaborator

Choose a reason for hiding this comment

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

this and below loop seems wrong to me, get() api will already populate all attributeList, and iy seems like you in 765 doing again some population? if those attributes must be refreshed, then they need to be done in refresh functions,
basically there should be no custom GET api implementations

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually, this function will never be used currently. We haven't had a finally conclusion about how to implement fetching the packet number of MACsec SA. Guohan's suggestion is we can skip this feature temporarily.
But I will remove this function if it's not acceptable to you.

Copy link
Collaborator

Choose a reason for hiding this comment

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

i think you can leave it if you want, ideally we would not like to have dead code in source, but if you gonna leave it, add TODO comment, with statement that i made, that get should have not other custom attribute changes

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 removed it and backup this version in my private repo. Please check it.

Signed-off-by: Ze Gan <ganze718@gmail.com>
@lgtm-com
Copy link

lgtm-com bot commented Dec 4, 2020

This pull request introduces 1 alert when merging 74e67c8 into d814d2c - view on LGTM.com

new alerts:

  • 1 for Comparison result is always the same

@lguohan
Copy link
Contributor

lguohan commented Dec 8, 2020

what is this new alerts?

@Pterosaur
Copy link
Contributor Author

what is this new alerts?

I didn't find any alert in the LGTM link. I'm not sure whether it's a false report of LGTM.

@lguohan lguohan merged commit adb0e98 into sonic-net:master Dec 13, 2020
kktheballer pushed a commit to kktheballer/sonic-sairedis that referenced this pull request Mar 10, 2021
Signed-off-by: Ze Gan <ganze718@gmail.com>
pettershao-ragilenetworks pushed a commit to pettershao-ragilenetworks/sonic-sairedis that referenced this pull request Nov 18, 2022
Signed-off-by: Ze Gan <ganze718@gmail.com>
@Pterosaur Pterosaur deleted the vslib_macsec branch January 12, 2023 04:24
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