Skip to content

Commit

Permalink
[pfcwdorch]: Add alert mode (sonic-net#342)
Browse files Browse the repository at this point in the history
Alert mode tells watchdog that whenever it detects PFC storm, it should
only write message to the log. It is implemented as a separate action
along with drop and forward.

Signed-off-by: marian-pritsak <marianp@mellanox.com>
  • Loading branch information
marian-pritsak authored and lguohan committed Oct 12, 2017
1 parent a3d3929 commit 41925f6
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion orchagent/pfcactionhandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class PfcWdActionHandler
public:
PfcWdActionHandler(sai_object_id_t port, sai_object_id_t queue,
uint8_t queueId, shared_ptr<Table> countersTable);
virtual ~PfcWdActionHandler(void) = 0;
virtual ~PfcWdActionHandler(void);

inline sai_object_id_t getPort(void)
{
Expand Down
9 changes: 9 additions & 0 deletions orchagent/pfcwdorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ PfcWdAction PfcWdOrch<DropHandler, ForwardHandler>::deserializeAction(const stri
{
{ "forward", PfcWdAction::PFC_WD_ACTION_FORWARD },
{ "drop", PfcWdAction::PFC_WD_ACTION_DROP },
{ "alert", PfcWdAction::PFC_WD_ACTION_ALERT },
};

if (actionMap.find(key) == actionMap.end())
Expand Down Expand Up @@ -445,6 +446,14 @@ void PfcWdSwOrch<DropHandler, ForwardHandler>::handleWdNotification(swss::Notifi
entry->second.index,
PfcWdOrch<DropHandler, ForwardHandler>::getCountersTable());
}
else if (entry->second.action == PfcWdAction::PFC_WD_ACTION_ALERT)
{
entry->second.handler = make_shared<PfcWdActionHandler>(
entry->second.portId,
entry->first,
entry->second.index,
PfcWdOrch<DropHandler, ForwardHandler>::getCountersTable());
}
else
{
throw runtime_error("Unknown PFC WD action");
Expand Down
1 change: 1 addition & 0 deletions orchagent/pfcwdorch.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ enum class PfcWdAction
PFC_WD_ACTION_UNKNOWN,
PFC_WD_ACTION_FORWARD,
PFC_WD_ACTION_DROP,
PFC_WD_ACTION_ALERT,
};

template <typename DropHandler, typename ForwardHandler>
Expand Down

0 comments on commit 41925f6

Please sign in to comment.