Skip to content
This repository was archived by the owner on Jan 3, 2023. It is now read-only.

Sonic saiv1.3 #1

Merged
merged 72 commits into from
Jun 1, 2018
Merged
Changes from 1 commit
Commits
Show all changes
72 commits
Select commit Hold shift + click to select a range
1a7e1cd
[acl]: Add support of ACL table bind to LAG and VLAN. (#349)
oleksandrivantsiv Dec 19, 2017
41caa74
Save fdb entries inside of fdborch until ports are ready (#406)
pavel-shirshov Dec 20, 2017
a043a55
[pfcwd]: Rx/Tx/Drop counters (#363)
marian-pritsak Dec 20, 2017
fbe781d
Add support for handling control plane ACLs (#416)
jleveque Dec 20, 2017
0e6183e
[pfcwd]:inherit PfcAclHanlder from PfcLossyHanlder (#423)
sihuihan88 Jan 3, 2018
b21fa47
[pfcwd]: Log PFC frame for a lossy queue (#422)
marian-pritsak Jan 10, 2018
8fb28c9
Add python test for setting RO attribute (#427)
kcudnik Jan 16, 2018
88636f9
[pfcwd]: rename FLEX_COUNTER_POLL_MSECS to PFC_WD_POLL_MSECS and move…
sihuihan88 Jan 17, 2018
6634744
[vrf orchagent]: Add Request parser class and VRF orchagent based on …
pavel-shirshov Jan 17, 2018
26d89f2
[pfcwd]: Log port name and queue index during storm detect/restore (#…
sihuihan88 Jan 18, 2018
eb58bb6
[portsorch]: Only add port stat IDs that are needed to query (#425)
sihuihan88 Jan 20, 2018
2bd7aab
[orchagent]: Fix typo (#434)
sihuihan88 Jan 23, 2018
60a90d7
Add Buffer Config Manager (#417)
andriymoroz-mlnx Jan 26, 2018
918cf5a
[fdborch]Add the support for a clear fdb cli (#426)
keboliu Jan 26, 2018
bc58daa
[pfcwd]: Assign different names to executors. (#433)
marian-pritsak Jan 29, 2018
bb366ed
[pfcwd]: Clean up auxilary fields, port ID (#431)
marian-pritsak Jan 29, 2018
5e98cb5
[sonic-swss/orchagent]: Added XON_OFFSET support (#438)
vharish02 Jan 29, 2018
450bb07
[vlanmgr]: Run a sequence of shell commands using bash -c (#436)
pavel-shirshov Jan 30, 2018
4227bee
Add speed and buffer set test (#432)
andriymoroz-mlnx Jan 31, 2018
6b2a591
[pfcwd]: delete pfcwd handler only when it exists (#442)
sihuihan88 Feb 2, 2018
9a037b8
[PfcWd]: Make polling interval configurable (#435)
sihuihan88 Feb 7, 2018
084903b
update to SAI 1.2
lguohan Nov 28, 2017
81b847d
set LAG PORT_VLAN_ID instead of member port VLAN id
lguohan Dec 2, 2017
9df9722
Directed broadcast changes with testcase (#5)
prsunny Feb 9, 2018
b7d8746
[swss - buffer manager] set xon_offset when available in lookup table…
yxieca Feb 15, 2018
da5f3d1
[swss - buffer manager] set xon_offset when available in lookup table…
yxieca Feb 15, 2018
86dd822
[portsorch]: Move PVID setting for port before adding it to LAG (#6)
Feb 21, 2018
0c8e06c
Merge branch 'master' into v1.2
lguohan Feb 21, 2018
6dd0870
Merge pull request #399 from lguohan/v1.2
lguohan Feb 22, 2018
6e274fb
[portsyncd] allow port syncd to parse port_config.ini in random colum…
yxieca Feb 25, 2018
e32212a
[lua]: Only set the entry values when they are not nil (#446)
sihuihan88 Mar 3, 2018
6e739b5
[crmorch]: Implement CRM feature (#447)
andriymoroz-mlnx Mar 2, 2018
664fea6
Add more instructions to build swss-common library
lguohan Mar 8, 2018
5643178
Crm tests (#448)
andriymoroz-mlnx Mar 13, 2018
4dab0c3
make reset crm polling interval effective immediately (#451)
lguohan Mar 14, 2018
05fb586
[countercheckorch]: Add watchdog to monitor packets on MC queues (#449)
marian-pritsak Mar 14, 2018
2ae1714
[sonic-swss] Support IPv6 ACL (#414)
zhenggen-xu Mar 14, 2018
ca55556
Support for platforms based on Barefoot Networks' device (#452)
Mar 16, 2018
ce78bf5
[portstat]: add new counters needed by snmp (#453)
sihuihan88 Mar 19, 2018
8e635fd
ECMP acceleration for physical i/f down events (#351)
nikos-github Mar 22, 2018
caa4f0b
[pfcwd]: Only register lossless tc counters in database for query (#455)
sihuihan88 Mar 26, 2018
8995b30
[countercheck]: move pfc counter alerting to countercheckorch (#456)
sihuihan88 Mar 26, 2018
d4ab3ee
[pfcwd]: only init counter when handler is created and change lua to …
sihuihan88 Mar 28, 2018
e217519
[pfcwd]: update counters of queues associated with handler when pfcwd…
sihuihan88 Mar 28, 2018
d711d2c
Update FDB CRM counters based on return value (#461)
prsunny Apr 6, 2018
114faa4
Align with swss-common table name separator changes (#454)
jleveque Apr 11, 2018
98c084a
FdbOrch getPort failed because fdb_entry have no switch_id (#466)
tylerlinp Apr 11, 2018
046628b
[pfcwd]: support BIG_RED_SWITCH mode (#467)
sihuihan88 Apr 13, 2018
a97f3ce
Use the refactored version of Selectables (#470)
pavel-shirshov Apr 16, 2018
880c1e9
[vlanmgr]: Fix the incorrect ip link del command for vlan remove (#474)
jipanyang Apr 16, 2018
57c9425
[crmorch]: neighbor used counter increased twice (#472)
tylerlinp Apr 17, 2018
e849afe
Use priorities in orch (#475)
pavel-shirshov Apr 17, 2018
d2c5a52
Updated CRM test case to check for exact used counter (#476)
prsunny Apr 18, 2018
aef6a46
[Portsorch]: The mtu configuration on the port cannot be updated if t…
leoli-nps Apr 19, 2018
39523aa
[orchagent]: Remove global lock caused by notifications running in an…
pavel-shirshov Apr 19, 2018
84ce5ed
[pfcwd]: create PFCWD acl instead of L3 ACL (#479)
sihuihan88 Apr 20, 2018
ccaa769
Fix ZeroBufferProfile parameters (#485)
andriymoroz-mlnx Apr 23, 2018
32bb66f
Fix tables handling race condition in buffermgr (#484)
andriymoroz-mlnx Apr 24, 2018
4a26e15
[counters]:separate query of port/queue counters (#483)
sihuihan88 Apr 24, 2018
edafa34
[buffermgr]: remove the item from consumer queue if invalid (#489)
sihuihan88 Apr 26, 2018
f939b95
[qosorch]: Optimizations of qosorch (#488)
pavel-shirshov Apr 27, 2018
bc97597
Add ipv6 ACL support in schema file (#490)
zhenggen-xu Apr 30, 2018
bb85c72
Populate existing interface cache, bring down before configDone (#491)
prsunny May 1, 2018
f71005a
[lua]: use not to check whether the field exists (#492)
sihuihan88 May 2, 2018
477d124
[PFCWD]: Periodically poll WD counters (#473)
marian-pritsak May 2, 2018
eef687e
[teamsyncd]: Add team_ifindex2ifname return value check (#500)
May 10, 2018
78c86ca
fix SAI_BUFFER_PROFILE_ATTR_SHARED_DYNAMIC_TH value mismatch bug (#495)
yangbashuang May 10, 2018
0246df7
[copporch]: Add SAI_HOSTIF_TRAP_TYPE_UDLD (#480)
May 11, 2018
59d0db1
Merge branch 'master' into sonicSaiv1.3
mkbalani May 14, 2018
7ed4761
Temp remove crmorch
mkbalani May 31, 2018
98c75be
Temp remove crmorch
mkbalani May 31, 2018
a8713ef
Merge branch 'bf-master' into sonicSaiv1.3
mkbalani May 31, 2018
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
Prev Previous commit
Next Next commit
[pfcwd]: Rx/Tx/Drop counters (sonic-net#363)
* [pfcwd]: Rx/Tx/Drop counters

Keep track of Tx/Rx/Drop packets during watchdog action.
Record both accumulative values and counters from last event.

Signed-off-by: marian-pritsak <marianp@mellanox.com>

* Address comments

Signed-off-by: marian-pritsak <marianp@mellanox.com>

* Address comments

Signed-off-by: marian-pritsak <marianp@mellanox.com>
marian-pritsak authored and lguohan committed Dec 20, 2017

Verified

This commit was signed with the committer’s verified signature.
passcod Félix Saparelli
commit a043a552ca96a5a3a3ec2c60c695700e0febc971
153 changes: 137 additions & 16 deletions orchagent/pfcactionhandler.cpp
Original file line number Diff line number Diff line change
@@ -12,8 +12,15 @@
#define PFC_WD_QUEUE_STATS_DEADLOCK_DETECTED "PFC_WD_QUEUE_STATS_DEADLOCK_DETECTED"
#define PFC_WD_QUEUE_STATS_DEADLOCK_RESTORED "PFC_WD_QUEUE_STATS_DEADLOCK_RESTORED"

#define SAI_QUEUE_STAT_PACKETS_STR "SAI_QUEUE_STAT_PACKETS"
#define SAI_QUEUE_STAT_DROPPED_PACKETS_STR "SAI_QUEUE_STAT_DROPPED_PACKETS"
#define PFC_WD_QUEUE_STATS_TX_PACKETS "PFC_WD_QUEUE_STATS_TX_PACKETS"
#define PFC_WD_QUEUE_STATS_TX_DROPPED_PACKETS "PFC_WD_QUEUE_STATS_TX_DROPPED_PACKETS"
#define PFC_WD_QUEUE_STATS_RX_PACKETS "PFC_WD_QUEUE_STATS_RX_PACKETS"
#define PFC_WD_QUEUE_STATS_RX_DROPPED_PACKETS "PFC_WD_QUEUE_STATS_RX_DROPPED_PACKETS"

#define PFC_WD_QUEUE_STATS_TX_PACKETS_LAST "PFC_WD_QUEUE_STATS_TX_PACKETS_LAST"
#define PFC_WD_QUEUE_STATS_TX_DROPPED_PACKETS_LAST "PFC_WD_QUEUE_STATS_TX_DROPPED_PACKETS_LAST"
#define PFC_WD_QUEUE_STATS_RX_PACKETS_LAST "PFC_WD_QUEUE_STATS_RX_PACKETS_LAST"
#define PFC_WD_QUEUE_STATS_RX_DROPPED_PACKETS_LAST "PFC_WD_QUEUE_STATS_RX_DROPPED_PACKETS_LAST"

extern sai_object_id_t gSwitchId;
extern PortsOrch *gPortsOrch;
@@ -35,30 +42,60 @@ PfcWdActionHandler::PfcWdActionHandler(sai_object_id_t port, sai_object_id_t que
"PFC Watchdog detected PFC storm on queue 0x%lx port 0x%lx",
m_queue,
m_port);

m_stats = getQueueStats(m_countersTable, sai_serialize_object_id(m_queue));
m_stats.detectCount++;
m_stats.operational = false;

updateWdCounters(sai_serialize_object_id(m_queue), m_stats);
}

PfcWdActionHandler::~PfcWdActionHandler(void)
{
SWSS_LOG_ENTER();

auto finalStats = getQueueStats(m_countersTable, sai_serialize_object_id(m_queue));

SWSS_LOG_NOTICE(
"Queue 0x%lx port 0x%lx restored from PFC storm. Tx packets: %lu. Dropped packets: %lu",
"Queue 0x%lx port 0x%lx restored from PFC storm.",
m_queue,
m_port,
finalStats.txPkt - m_stats.txPkt,
finalStats.txDropPkt - m_stats.txDropPkt);
m_port);
}

void PfcWdActionHandler::initCounters(void)
{
SWSS_LOG_ENTER();

if (!getHwCounters(m_hwStats))
{
return;
}

auto wdQueueStats = getQueueStats(m_countersTable, sai_serialize_object_id(m_queue));
wdQueueStats.detectCount++;
wdQueueStats.operational = false;

updateWdCounters(sai_serialize_object_id(m_queue), wdQueueStats);
}

void PfcWdActionHandler::commitCounters(void)
{
SWSS_LOG_ENTER();

PfcWdHwStats hwStats;

if (!getHwCounters(hwStats))
{
return;
}

auto finalStats = getQueueStats(m_countersTable, sai_serialize_object_id(m_queue));

finalStats.restoreCount++;
finalStats.operational = true;

finalStats.txPktLast = hwStats.txPkt - m_hwStats.txPkt;
finalStats.txDropPktLast = hwStats.txDropPkt - m_hwStats.txDropPkt;
finalStats.rxPktLast = hwStats.rxPkt - m_hwStats.rxPkt;
finalStats.rxDropPktLast = hwStats.rxDropPkt - m_hwStats.rxDropPkt;

finalStats.txPkt += finalStats.txPktLast;
finalStats.txDropPkt += finalStats.txDropPktLast;
finalStats.rxPkt += finalStats.rxPktLast;
finalStats.rxDropPkt += finalStats.rxDropPktLast;

updateWdCounters(sai_serialize_object_id(m_queue), finalStats);
}

@@ -67,6 +104,8 @@ PfcWdActionHandler::PfcWdQueueStats PfcWdActionHandler::getQueueStats(shared_ptr
SWSS_LOG_ENTER();

PfcWdQueueStats stats;
memset(&stats, 0, sizeof(PfcWdQueueStats));
stats.operational = true;
vector<FieldValueTuple> fieldValues;

if (!countersTable->get(queueIdStr, fieldValues))
@@ -91,14 +130,22 @@ PfcWdActionHandler::PfcWdQueueStats PfcWdActionHandler::getQueueStats(shared_ptr
{
stats.operational = value == PFC_WD_QUEUE_STATUS_OPERATIONAL ? true : false;
}
else if (field == SAI_QUEUE_STAT_PACKETS_STR)
else if (field == PFC_WD_QUEUE_STATS_TX_PACKETS)
{
stats.txPkt = stoul(value);
}
else if (field == SAI_QUEUE_STAT_DROPPED_PACKETS_STR)
else if (field == PFC_WD_QUEUE_STATS_TX_DROPPED_PACKETS)
{
stats.txDropPkt = stoul(value);
}
else if (field == PFC_WD_QUEUE_STATS_RX_PACKETS)
{
stats.rxPkt = stoul(value);
}
else if (field == PFC_WD_QUEUE_STATS_RX_DROPPED_PACKETS)
{
stats.rxDropPkt = stoul(value);
}
}

return move(stats);
@@ -127,6 +174,17 @@ void PfcWdActionHandler::updateWdCounters(const string& queueIdStr, const PfcWdQ

resultFvValues.emplace_back(PFC_WD_QUEUE_STATS_DEADLOCK_DETECTED, to_string(stats.detectCount));
resultFvValues.emplace_back(PFC_WD_QUEUE_STATS_DEADLOCK_RESTORED, to_string(stats.restoreCount));

resultFvValues.emplace_back(PFC_WD_QUEUE_STATS_TX_PACKETS, to_string(stats.txPkt));
resultFvValues.emplace_back(PFC_WD_QUEUE_STATS_TX_DROPPED_PACKETS, to_string(stats.txDropPkt));
resultFvValues.emplace_back(PFC_WD_QUEUE_STATS_RX_PACKETS, to_string(stats.rxPkt));
resultFvValues.emplace_back(PFC_WD_QUEUE_STATS_RX_DROPPED_PACKETS, to_string(stats.rxDropPkt));

resultFvValues.emplace_back(PFC_WD_QUEUE_STATS_TX_PACKETS_LAST, to_string(stats.txPktLast));
resultFvValues.emplace_back(PFC_WD_QUEUE_STATS_TX_DROPPED_PACKETS_LAST, to_string(stats.txDropPktLast));
resultFvValues.emplace_back(PFC_WD_QUEUE_STATS_RX_PACKETS_LAST, to_string(stats.rxPktLast));
resultFvValues.emplace_back(PFC_WD_QUEUE_STATS_RX_DROPPED_PACKETS_LAST, to_string(stats.rxDropPktLast));

resultFvValues.emplace_back(PFC_WD_QUEUE_STATUS, stats.operational ?
PFC_WD_QUEUE_STATUS_OPERATIONAL :
PFC_WD_QUEUE_STATUS_STORMED);
@@ -292,6 +350,69 @@ PfcWdLossyHandler::~PfcWdLossyHandler(void)
}
}

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

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

static const vector<sai_ingress_priority_group_stat_t> pgStatIds =
{
SAI_INGRESS_PRIORITY_GROUP_STAT_PACKETS,
SAI_INGRESS_PRIORITY_GROUP_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%lx stats: %d", getQueue(), status);
return false;
}

// PG counters not yet supported in Mellanox platform
Port portInstance;
if (!gPortsOrch->getPort(getPort(), portInstance))
{
SWSS_LOG_ERROR("Cannot get port by ID 0x%lx", getPort());
return false;
}

sai_object_id_t pg = portInstance.m_priority_group_ids[getQueueId()];
vector<uint64_t> pgStats;
pgStats.resize(pgStatIds.size());

status = sai_buffer_api->get_ingress_priority_group_stats(
pg,
static_cast<uint32_t>(pgStatIds.size()),
pgStatIds.data(),
pgStats.data());

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

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

return true;
}

PfcWdZeroBufferHandler::PfcWdZeroBufferHandler(sai_object_id_t port,
sai_object_id_t queue, uint8_t queueId, shared_ptr<Table> countersTable):
PfcWdLossyHandler(port, queue, queueId, countersTable)
36 changes: 30 additions & 6 deletions orchagent/pfcactionhandler.h
Original file line number Diff line number Diff line change
@@ -13,6 +13,14 @@ extern "C" {
using namespace std;
using namespace swss;

struct PfcWdHwStats
{
uint64_t txPkt;
uint64_t txDropPkt;
uint64_t rxPkt;
uint64_t rxDropPkt;
};

// PFC queue interface class
// It resembles RAII behavior - pause storm is mitigated (queue is locked) on creation,
// and is restored (queue released) on removal
@@ -39,15 +47,30 @@ class PfcWdActionHandler
}

static void initWdCounters(shared_ptr<Table> countersTable, const string &queueIdStr);
void initCounters(void);
void commitCounters(void);

virtual bool getHwCounters(PfcWdHwStats& counters)
{
memset(&counters, 0, sizeof(PfcWdHwStats));

return true;
};

private:
struct PfcWdQueueStats
{
uint64_t detectCount = 0;
uint64_t restoreCount = 0;
uint64_t txPkt = 0;
uint64_t txDropPkt = 0;
bool operational = true;
uint64_t detectCount;
uint64_t restoreCount;
uint64_t txPkt;
uint64_t txDropPkt;
uint64_t rxPkt;
uint64_t rxDropPkt;
uint64_t txPktLast;
uint64_t txDropPktLast;
uint64_t rxPktLast;
uint64_t rxDropPktLast;
bool operational;
};

static PfcWdQueueStats getQueueStats(shared_ptr<Table> countersTable, const string &queueIdStr);
@@ -57,7 +80,7 @@ class PfcWdActionHandler
sai_object_id_t m_queue = SAI_NULL_OBJECT_ID;
uint8_t m_queueId = 0;
shared_ptr<Table> m_countersTable = nullptr;
PfcWdQueueStats m_stats;
PfcWdHwStats m_hwStats;
};

class PfcWdAclHandler: public PfcWdActionHandler
@@ -87,6 +110,7 @@ class PfcWdLossyHandler: public PfcWdActionHandler
PfcWdLossyHandler(sai_object_id_t port, sai_object_id_t queue,
uint8_t queueId, shared_ptr<Table> countersTable);
virtual ~PfcWdLossyHandler(void);
virtual bool getHwCounters(PfcWdHwStats& counters);
};

// PFC queue that implements drop action by draining queue with buffer of zero size
2 changes: 2 additions & 0 deletions orchagent/pfcwdorch.cpp
Original file line number Diff line number Diff line change
@@ -506,9 +506,11 @@ void PfcWdSwOrch<DropHandler, ForwardHandler>::doTask(swss::NotificationConsumer
{
throw runtime_error("Unknown PFC WD action");
}
entry->second.handler->initCounters();
}
else if (event == "restore")
{
entry->second.handler->commitCounters();
entry->second.handler = nullptr;
}
else