Skip to content

Commit

Permalink
Add function to refresh macsec sa stat (sonic-net#861)
Browse files Browse the repository at this point in the history
Signed-off-by: Ze Gan <ganze718@gmail.com>
  • Loading branch information
Pterosaur committed Jul 14, 2021
1 parent 8123e32 commit 539fdcd
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
3 changes: 3 additions & 0 deletions vslib/inc/SwitchStateBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,9 @@ namespace saivs
virtual sai_status_t refresh_queue_pause_status(
_In_ sai_object_id_t object_id);

virtual sai_status_t refresh_macsec_sa_stat(
_In_ sai_object_id_t object_id);

public:

virtual sai_status_t warm_boot_initialize_objects();
Expand Down
19 changes: 19 additions & 0 deletions vslib/src/SwitchStateBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2077,6 +2077,20 @@ sai_status_t SwitchStateBase::refresh_queue_pause_status(
return SAI_STATUS_SUCCESS;
}

sai_status_t SwitchStateBase::refresh_macsec_sa_stat(
_In_ sai_object_id_t object_id)
{
SWSS_LOG_ENTER();

sai_attribute_t attr;

attr.id = SAI_MACSEC_SA_ATTR_CURRENT_XPN;
CHECK_STATUS(getMACsecSAPacketNumber(object_id, attr));
CHECK_STATUS(set(SAI_OBJECT_TYPE_MACSEC_SA, object_id, &attr));

return SAI_STATUS_SUCCESS;
}

// XXX extra work may be needed on GET api if N on list will be > then actual

/*
Expand Down Expand Up @@ -2231,6 +2245,11 @@ sai_status_t SwitchStateBase::refresh_read_only(
return refresh_queue_pause_status(object_id);
}

if (meta->objecttype == SAI_OBJECT_TYPE_MACSEC_SA)
{
return refresh_macsec_sa_stat(object_id);
}

auto mmeta = m_meta.lock();

if (mmeta)
Expand Down

0 comments on commit 539fdcd

Please sign in to comment.