-
Notifications
You must be signed in to change notification settings - Fork 275
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add SAI Notification support for host_tx_ready
- Loading branch information
Showing
19 changed files
with
405 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
#include "NotificationPortHostTxReadyEvent.h" | ||
|
||
#include "swss/logger.h" | ||
|
||
#include "sai_serialize.h" | ||
|
||
using namespace sairedis; | ||
|
||
// NotificationSwitchStateChange::NotificationSwitchStateChange( | ||
// _In_ const std::string& serializedNotification): | ||
// Notification( | ||
// SAI_SWITCH_NOTIFICATION_TYPE_SWITCH_STATE_CHANGE, | ||
// serializedNotification) | ||
|
||
NotificationPortHostTxReady::NotificationPortHostTxReady( | ||
_In_ const std::string& serializedNotification): | ||
Notification( | ||
SAI_SWITCH_NOTIFICATION_TYPE_PORT_HOST_TX_READY, | ||
serializedNotification) | ||
{ | ||
SWSS_LOG_ENTER(); | ||
|
||
sai_deserialize_port_host_tx_ready_ntf( | ||
serializedNotification, | ||
m_switchId, | ||
m_portId, | ||
m_portHostTxReadyStatus); | ||
} | ||
|
||
NotificationPortHostTxReady::~NotificationPortHostTxReady() | ||
{ | ||
SWSS_LOG_ENTER(); | ||
|
||
sai_deserialize_free_port_host_tx_ready_ntf(m_portHostTxReadyStatus); | ||
} | ||
|
||
sai_object_id_t NotificationPortHostTxReady::getSwitchId() const | ||
{ | ||
SWSS_LOG_ENTER(); | ||
|
||
return m_switchId; | ||
} | ||
|
||
sai_object_id_t NotificationPortHostTxReady::getAnyObjectId() const | ||
{ | ||
SWSS_LOG_ENTER(); | ||
|
||
if (m_portId != SAI_NULL_OBJECT_ID) | ||
{ | ||
return m_portId; | ||
} | ||
|
||
return SAI_NULL_OBJECT_ID; | ||
} | ||
|
||
void NotificationPortHostTxReady::processMetadata( | ||
_In_ std::shared_ptr<saimeta::Meta> meta) const | ||
{ | ||
SWSS_LOG_ENTER(); | ||
|
||
meta->meta_sai_on_port_host_tx_ready_change(m_portId, m_switchId, m_portHostTxReadyStatus); | ||
} | ||
|
||
void NotificationPortHostTxReady::executeCallback( | ||
_In_ const sai_switch_notifications_t& switchNotifications) const | ||
{ | ||
SWSS_LOG_ENTER(); | ||
|
||
if (switchNotifications.on_port_host_tx_ready) | ||
{ | ||
switchNotifications.on_port_host_tx_ready(m_switchId, m_portId, m_portHostTxReadyStatus); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#pragma once | ||
|
||
#include "Notification.h" | ||
|
||
namespace sairedis | ||
{ | ||
class NotificationPortHostTxReady: | ||
public Notification | ||
{ | ||
public: | ||
|
||
NotificationPortHostTxReady( | ||
_In_ const std::string& serializedNotification); | ||
|
||
virtual ~NotificationPortHostTxReady(); | ||
|
||
public: | ||
|
||
virtual sai_object_id_t getSwitchId() const override; | ||
|
||
virtual sai_object_id_t getAnyObjectId() const override; | ||
|
||
virtual void processMetadata( | ||
_In_ std::shared_ptr<saimeta::Meta> meta) const override; | ||
|
||
virtual void executeCallback( | ||
_In_ const sai_switch_notifications_t& switchNotifications) const override; | ||
|
||
private: | ||
|
||
sai_object_id_t m_portId; | ||
|
||
sai_object_id_t m_switchId; | ||
|
||
sai_port_host_tx_ready_status_t m_portHostTxReadyStatus; | ||
|
||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.