Skip to content

Commit

Permalink
[vslib] Refresh queue pause status (#814)
Browse files Browse the repository at this point in the history
  • Loading branch information
wendani authored Mar 31, 2021
1 parent 00d883c commit 0372615
Show file tree
Hide file tree
Showing 2 changed files with 26 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 @@ -149,6 +149,9 @@ namespace saivs
virtual sai_status_t refresh_macsec_sci_in_ingress_macsec_acl(
_In_ sai_object_id_t object_id);

virtual sai_status_t refresh_queue_pause_status(
_In_ sai_object_id_t object_id);

public:

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

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

// To trigger fake PFC storm on fake Broadcom platform, PFC storm detection
// lua requires SAI_QUEUE_ATTR_PAUSE_STATUS field to be present in COUNTERS_DB.
// However, the actual value of the attribute does not matter in this regard,
// so a dummy one is assigned here.
sai_attribute_t attr;
attr.id = SAI_QUEUE_ATTR_PAUSE_STATUS;
attr.value.booldata = false;

CHECK_STATUS(set(SAI_OBJECT_TYPE_QUEUE, 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 @@ -2205,6 +2223,11 @@ sai_status_t SwitchStateBase::refresh_read_only(
return refresh_macsec_sci_in_ingress_macsec_acl(object_id);
}

if (meta->objecttype == SAI_OBJECT_TYPE_QUEUE && meta->attrid == SAI_QUEUE_ATTR_PAUSE_STATUS)
{
return refresh_queue_pause_status(object_id);
}

auto mmeta = m_meta.lock();

if (mmeta)
Expand Down

0 comments on commit 0372615

Please sign in to comment.