Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

patch for issue #1971 - enable Rx Drop handling for cisco-8000 #2041

Merged
merged 3 commits into from
Dec 17, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion orchagent/pfc_restore_cisco-8000.lua
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ for i = n, 1, -1 do
and (debug_storm ~= "enabled")
-- DEBUG CODE END.
then
if time_left <= 0 then
if time_left <= poll_time then
neethajohn marked this conversation as resolved.
Show resolved Hide resolved
redis.call('PUBLISH', 'PFC_WD_ACTION', '["' .. KEYS[i] .. '","restore"]')
time_left = restoration_time
else
Expand Down
67 changes: 33 additions & 34 deletions orchagent/pfcactionhandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ void PfcWdActionHandler::updateWdCounters(const string& queueIdStr, const PfcWdQ

PfcWdSaiDlrInitHandler::PfcWdSaiDlrInitHandler(sai_object_id_t port, sai_object_id_t queue,
uint8_t queueId, shared_ptr<Table> countersTable):
PfcWdActionHandler(port, queue, queueId, countersTable)
PfcWdZeroBufferHandler(port, queue, queueId, countersTable)
{
SWSS_LOG_ENTER();

Expand Down Expand Up @@ -262,39 +262,6 @@ PfcWdSaiDlrInitHandler::~PfcWdSaiDlrInitHandler(void)
}
}

bool PfcWdSaiDlrInitHandler::getHwCounters(PfcWdHwStats& counters)
{
SWSS_LOG_ENTER();

static const vector<sai_stat_id_t> queueStatIds =
{
SAI_QUEUE_STAT_PACKETS,
SAI_QUEUE_STAT_DROPPED_PACKETS,
};

vector<uint64_t> queueStats;
queueStats.resize(queueStatIds.size());

sai_status_t status = sai_queue_api->get_queue_stats(
getQueue(),
static_cast<uint32_t>(queueStatIds.size()),
queueStatIds.data(),
queueStats.data());

if (status != SAI_STATUS_SUCCESS)
{
SWSS_LOG_ERROR("Failed to fetch queue 0x%" PRIx64 " stats: %d", getQueue(), status);
return false;
}

counters.txPkt = queueStats[0];
counters.txDropPkt = queueStats[1];
counters.rxPkt = 0;
counters.rxDropPkt = 0;

return true;
}

PfcWdAclHandler::PfcWdAclHandler(sai_object_id_t port, sai_object_id_t queue,
uint8_t queueId, shared_ptr<Table> countersTable):
PfcWdLossyHandler(port, queue, queueId, countersTable)
Expand Down Expand Up @@ -469,6 +436,22 @@ PfcWdLossyHandler::PfcWdLossyHandler(sai_object_id_t port, sai_object_id_t queue
{
SWSS_LOG_ENTER();

const char *env_plat = getenv("platform");
if (env_plat == nullptr)
alpeshspatel marked this conversation as resolved.
Show resolved Hide resolved
{
string platform("");
}
else
{
string platform(env_plat);
if (platform == CISCO_8000_PLATFORM_SUBSTRING)
{
SWSS_LOG_DEBUG("Skipping in constructor PfcWdLossyHandler for platform %s on port 0x%" PRIx64,
platform.c_str(), port);
return;
}
}

uint8_t pfcMask = 0;

if (!gPortsOrch->getPortPfc(port, &pfcMask))
Expand All @@ -488,6 +471,22 @@ PfcWdLossyHandler::~PfcWdLossyHandler(void)
{
SWSS_LOG_ENTER();

const char *env_plat = getenv("platform");
if (env_plat == nullptr)
{
string platform("");
}
else
{
string platform(env_plat);
if (platform == CISCO_8000_PLATFORM_SUBSTRING)
{
SWSS_LOG_DEBUG("Skipping in destructor PfcWdLossyHandler for platform %s on port 0x%" PRIx64,
platform.c_str(), getPort());
return;
}
}

uint8_t pfcMask = 0;

if (!gPortsOrch->getPortPfc(getPort(), &pfcMask))
Expand Down
3 changes: 1 addition & 2 deletions orchagent/pfcactionhandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -165,13 +165,12 @@ class PfcWdZeroBufferHandler: public PfcWdLossyHandler

// PFC queue that implements drop action by draining queue via SAI
// attribute SAI_QUEUE_ATTR_PFC_DLR_INIT.
class PfcWdSaiDlrInitHandler: public PfcWdActionHandler
class PfcWdSaiDlrInitHandler: public PfcWdZeroBufferHandler
{
public:
PfcWdSaiDlrInitHandler(sai_object_id_t port, sai_object_id_t queue,
uint8_t queueId, shared_ptr<Table> countersTable);
virtual ~PfcWdSaiDlrInitHandler(void);
virtual bool getHwCounters(PfcWdHwStats& counters);
};

#endif