Skip to content

Commit

Permalink
[syncd] re-establish notifications after warm boot (sonic-net#368)
Browse files Browse the repository at this point in the history
Signed-off-by: Ying Xie <ying.xie@microsoft.com>
  • Loading branch information
yxieca authored Oct 31, 2018
1 parent d655d20 commit a6b709a
Showing 1 changed file with 19 additions and 4 deletions.
23 changes: 19 additions & 4 deletions syncd/syncd_hard_reinit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1253,10 +1253,25 @@ void performWarmRestart()
sai_object_id_t orig_rid = translate_vid_to_rid(switch_vid);

sai_object_id_t switch_rid;
sai_attribute_t switch_attr;
switch_attr.id = SAI_SWITCH_ATTR_INIT_SWITCH;
switch_attr.value.booldata = true;
sai_status_t status = sai_metadata_sai_switch_api->create_switch(&switch_rid, 1, &switch_attr);
sai_attr_id_t notifs[] = {
SAI_SWITCH_ATTR_SWITCH_STATE_CHANGE_NOTIFY,
SAI_SWITCH_ATTR_SHUTDOWN_REQUEST_NOTIFY,
SAI_SWITCH_ATTR_FDB_EVENT_NOTIFY,
SAI_SWITCH_ATTR_PORT_STATE_CHANGE_NOTIFY,
SAI_SWITCH_ATTR_PACKET_EVENT_NOTIFY,
SAI_SWITCH_ATTR_QUEUE_PFC_DEADLOCK_NOTIFY
};
#define NELMS(arr) (sizeof(arr) / sizeof(arr[0]))
sai_attribute_t switch_attrs[NELMS(notifs) + 1];
switch_attrs[0].id = SAI_SWITCH_ATTR_INIT_SWITCH;
switch_attrs[0].value.booldata = true;
for (size_t i = 0; i < NELMS(notifs); i++)
{
switch_attrs[i+1].id = notifs[i];
switch_attrs[i+1].value.ptr = (void *)1; // any non-null pointer
}
check_notifications_pointers((uint32_t)NELMS(switch_attrs), &switch_attrs[0]);
sai_status_t status = sai_metadata_sai_switch_api->create_switch(&switch_rid, (uint32_t)NELMS(switch_attrs), &switch_attrs[0]);

if (status != SAI_STATUS_SUCCESS)
{
Expand Down

0 comments on commit a6b709a

Please sign in to comment.