Skip to content
This repository was archived by the owner on Jan 3, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
53831be
[pfcwd]: create PFCWD acl instead of L3 ACL (#479)
sihuihan88 Apr 20, 2018
ea34b92
Fix tables handling race condition in buffermgr (#484)
andriymoroz-mlnx Apr 24, 2018
1f857d5
[buffermgr]: remove the item from consumer queue if invalid (#489)
sihuihan88 Apr 26, 2018
e34104e
[pfcwd]: support BIG_RED_SWITCH mode (#467)
sihuihan88 Apr 13, 2018
118b3f0
Populate existing interface cache, bring down before configDone (#491)
prsunny May 1, 2018
d57f9a1
[lua]: use not to check whether the field exists (#492)
sihuihan88 May 2, 2018
236843f
Fix Crm Acl used counter update (#496)
May 7, 2018
b57c376
[teamsyncd]: Add team_ifindex2ifname return value check (#500)
May 10, 2018
c374357
Fix ZeroBufferProfile parameters (#485)
andriymoroz-mlnx Apr 23, 2018
43365f3
[crmorch]: neighbor used counter increased twice (#472) (#501)
May 14, 2018
410b870
Don't print 'orchagent: :- doPortTask: Failed to get port id by alias…
pavel-shirshov May 14, 2018
681ba13
[aclorch]: remove SAI_ACL_TABLE_ATTR_FIELD_TC from data/mirror acl ty…
sihuihan88 May 16, 2018
1ac125e
[test]: add portchannel vs test (#507)
lguohan May 17, 2018
66287cf
fix SAI_BUFFER_PROFILE_ATTR_SHARED_DYNAMIC_TH value type mismatch bug…
yangbashuang May 17, 2018
8314a94
[acl]: Insert new acl rule with priority in between other rules (#482)
simone-dell May 17, 2018
8d810be
[portsorch]: Rewrite validatePortSpeed() method. Use true lazy approa…
pavel-shirshov May 17, 2018
a1b6fa3
[vlanmgr]: Fix the incorrect ip link del command for vlan remove (#474)
jipanyang Apr 16, 2018
8c23538
[flexcounter]: add support to change port/queue counter poll interval…
sihuihan88 May 18, 2018
7331f92
[queuestat]: remove no need counters from query (#508)
sihuihan88 May 18, 2018
44a8845
Suppress Cable length errors in case pg profile lookup file is not pr…
zhenggen-xu May 25, 2018
4df9c28
[AclOrch] aclOrch enhancement to handle LAG port not configured case …
keboliu May 25, 2018
0f43351
[AclOrch] aclOrch enhancement to handle LAG port not configured case …
keboliu May 25, 2018
d8e7ad4
Merge branch '201803' into master
lguohan May 31, 2018
92c3171
Raise the priority of LAG_TABLE to 44 so it has precedence over VLAN_…
jipanyang Jun 1, 2018
44309ef
[acl]: test different subnet masks (#481)
simone-dell Jun 8, 2018
2176688
[portsorch]: Bring the physical ports up are only after buffer config…
pavel-shirshov Jun 8, 2018
ad61242
VS: Check oper_status of the link being brought up instead of Etherne…
jipanyang Jun 13, 2018
6189eaa
Allocate buffer for 256 entries for ACL resource query (#523)
prsunny Jun 13, 2018
98ad0bd
[counter]: add support to enable/disable counter query (#511)
sihuihan88 Jun 19, 2018
27b29e3
Fix double freeing bug in fdb event handler (#525)
pavel-shirshov Jun 22, 2018
72a7f3a
[counterpoll]:enable/disable pfcwd counter query (#526)
sihuihan88 Jun 25, 2018
258ffe6
Pospone QueueMap initialization until activation of counters (#527)
pavel-shirshov Jun 26, 2018
90ea7a4
Initialize CounterCheckOrch with port information after QueueMaps ini…
pavel-shirshov Jun 29, 2018
19e6c72
[doc] Fix the build checker links (#531)
qiluo-msft Jul 2, 2018
82a95a1
Generate queue maps only for front panel ports (#532)
pavel-shirshov Jul 2, 2018
23bb493
Update README.md (#533)
qiluo-msft Jul 3, 2018
22bb2cd
Check m_port_ready_list_ref value for presense before using the value…
pavel-shirshov Jul 3, 2018
19f9108
SAI 1.3 header changes (#520)
prsunny Jul 5, 2018
5d31b2d
Create empty ready lists for buffers by default (#535)
pavel-shirshov Jul 5, 2018
8d3cfd8
Merge remote-tracking branch 'azure/master' into azure-merge
Jul 9, 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
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Broadcom[![Broadcom](https://sonic-jenkins.westus2.cloudapp.azure.com/job/broadcom/job/sonic-swss-build/badge/icon)](https://sonic-jenkins.westus.cloudapp.azure.com/job/broadcom/job/sonic-swss-build/)
Cavium[![Cavium](https://sonic-jenkins.westus2.cloudapp.azure.com/job/cavium/job/sonic-swss-build/badge/icon)](https://sonic-jenkins.westus.cloudapp.azure.com/job/cavium/job/sonic-swss-build/)
Mellanox[![Mellanox](https://sonic-jenkins.westus2.cloudapp.azure.com/job/mellanox/job/sonic-swss-build/badge/icon)](https://sonic-jenkins.westus.cloudapp.azure.com/job/mellanox/job/sonic-swss-build/)
P4[![P4](https://sonic-jenkins.westus2.cloudapp.azure.com/job/p4/job/sonic-swss-build/badge/icon)](https://sonic-jenkins.westus.cloudapp.azure.com/job/p4/job/sonic-swss-build/)
Broadcom[![Broadcom](https://sonic-jenkins.westus2.cloudapp.azure.com/job/broadcom/job/sonic-swss-build/badge/icon)](https://sonic-jenkins.westus2.cloudapp.azure.com/job/broadcom/job/sonic-swss-build/)
Cavium[![Cavium](https://sonic-jenkins.westus2.cloudapp.azure.com/job/cavium/job/sonic-swss-build/badge/icon)](https://sonic-jenkins.westus2.cloudapp.azure.com/job/cavium/job/sonic-swss-build/)
Mellanox[![Mellanox](https://sonic-jenkins.westus2.cloudapp.azure.com/job/mellanox/job/sonic-swss-build/badge/icon)](https://sonic-jenkins.westus2.cloudapp.azure.com/job/mellanox/job/sonic-swss-build/)
P4[![P4](https://sonic-jenkins.westus2.cloudapp.azure.com/job/p4/job/sonic-swss-build/badge/icon)](https://sonic-jenkins.westus2.cloudapp.azure.com/job/p4/job/sonic-swss-build/)

# SONiC - SWitch State Service - SWSS

Expand Down
6 changes: 5 additions & 1 deletion cfgmgr/buffermgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,12 @@ void BufferMgr::readPgProfileLookupFile(string file)
{
SWSS_LOG_NOTICE("Read lookup configuration file...");

m_pgfile_processed = false;

ifstream infile(file);
if (!infile.is_open())
{
SWSS_LOG_WARN("PG profile lookup file: %s is not readable", file.c_str());
return;
}

Expand Down Expand Up @@ -69,6 +72,7 @@ void BufferMgr::readPgProfileLookupFile(string file)
);
}

m_pgfile_processed = true;
infile.close();
}

Expand Down Expand Up @@ -211,7 +215,7 @@ void BufferMgr::doTask(Consumer &consumer)
task_status = doCableTask(fvField(i), fvValue(i));
}
// In case of PORT table update, Buffer Manager is interested in speed update only
if (table_name == CFG_PORT_TABLE_NAME && fvField(i) == "speed")
if (m_pgfile_processed && table_name == CFG_PORT_TABLE_NAME && fvField(i) == "speed")
{
// create/update profile for port
task_status = doSpeedUpdateTask(port, fvValue(i));
Expand Down
1 change: 1 addition & 0 deletions cfgmgr/buffermgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ class BufferMgr : public Orch
Table m_cfgBufferProfileTable;
Table m_cfgBufferPgTable;
Table m_cfgLosslessPgPoolTable;
bool m_pgfile_processed;

pg_profile_lookup_t m_pgProfileLookup;
port_cable_length_t m_cableLenLookup;
Expand Down
4 changes: 3 additions & 1 deletion orchagent/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ orchagent_SOURCES = \
vrforch.cpp \
countercheckorch.cpp \
dtelorch.cpp \
flexcounterorch.cpp\
acltable.h \
aclorch.h \
bufferorch.h \
Expand All @@ -69,7 +70,8 @@ orchagent_SOURCES = \
request_parser.h \
vrforch.h \
dtelorch.h \
countercheckorch.h
countercheckorch.h \
flexcounterorch.h

orchagent_CFLAGS = $(DBGFLAGS) $(AM_CFLAGS) $(CFLAGS_COMMON) $(CFLAGS_SAI)
orchagent_CPPFLAGS = $(DBGFLAGS) $(AM_CFLAGS) $(CFLAGS_COMMON) $(CFLAGS_SAI)
Expand Down
168 changes: 123 additions & 45 deletions orchagent/aclorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -999,7 +999,7 @@ bool AclTable::validate()
{
// Control plane ACLs are handled by a separate process
if (type == ACL_TABLE_UNKNOWN || type == ACL_TABLE_CTRLPLANE) return false;
if (ports.empty()) return false;
if (portSet.empty()) return false;
return true;
}

Expand Down Expand Up @@ -1121,10 +1121,6 @@ bool AclTable::create()
attr.value.booldata = true;
table_attrs.push_back(attr);

attr.id = SAI_ACL_TABLE_ATTR_FIELD_TC;
attr.value.booldata = true;
table_attrs.push_back(attr);

if(stage == ACL_STAGE_INGRESS)
{
attr.id = SAI_ACL_TABLE_ATTR_FIELD_ACL_RANGE_TYPE;
Expand Down Expand Up @@ -1694,7 +1690,7 @@ bool AclRange::remove()
return true;
}

void AclOrch::init(DBConnector *db, vector<string> tableNames, PortsOrch *portOrch, MirrorOrch *mirrorOrch, NeighOrch *neighOrch, RouteOrch *routeOrch)
void AclOrch::init(vector<TableConnector>& connectors, PortsOrch *portOrch, MirrorOrch *mirrorOrch, NeighOrch *neighOrch, RouteOrch *routeOrch)
{
SWSS_LOG_ENTER();

Expand Down Expand Up @@ -1725,28 +1721,28 @@ void AclOrch::init(DBConnector *db, vector<string> tableNames, PortsOrch *portOr
timer->start();
}

AclOrch::AclOrch(DBConnector *db, vector<string> tableNames, PortsOrch *portOrch, MirrorOrch *mirrorOrch, NeighOrch *neighOrch, RouteOrch *routeOrch) :
Orch(db, tableNames),
AclOrch::AclOrch(vector<TableConnector>& connectors, PortsOrch *portOrch, MirrorOrch *mirrorOrch, NeighOrch *neighOrch, RouteOrch *routeOrch) :
Orch(connectors),
m_mirrorOrch(mirrorOrch),
m_neighOrch(neighOrch),
m_routeOrch(routeOrch),
m_dTelOrch(NULL)
{
SWSS_LOG_ENTER();

init(db, tableNames, portOrch, mirrorOrch, neighOrch, routeOrch);
init(connectors, portOrch, mirrorOrch, neighOrch, routeOrch);
}

AclOrch::AclOrch(DBConnector *db, vector<string> tableNames, PortsOrch *portOrch, MirrorOrch *mirrorOrch, NeighOrch *neighOrch, RouteOrch *routeOrch, DTelOrch *dtelOrch) :
Orch(db, tableNames),
AclOrch::AclOrch(vector<TableConnector>& connectors, PortsOrch *portOrch, MirrorOrch *mirrorOrch, NeighOrch *neighOrch, RouteOrch *routeOrch, DTelOrch *dtelOrch) :
Orch(connectors),
m_mirrorOrch(mirrorOrch),
m_neighOrch(neighOrch),
m_routeOrch(routeOrch),
m_dTelOrch(dtelOrch)
{
SWSS_LOG_ENTER();

init(db, tableNames, portOrch, mirrorOrch, neighOrch, routeOrch);
init(connectors, portOrch, mirrorOrch, neighOrch, routeOrch);

if (m_dTelOrch)
{
Expand Down Expand Up @@ -1812,6 +1808,11 @@ void AclOrch::doTask(Consumer &consumer)
unique_lock<mutex> lock(m_countersMutex);
doAclRuleTask(consumer);
}
else if (table_name == STATE_LAG_TABLE_NAME)
{
unique_lock<mutex> lock(m_countersMutex);
doAclTablePortUpdateTask(consumer);
}
else
{
SWSS_LOG_ERROR("Invalid table %s", table_name.c_str());
Expand Down Expand Up @@ -1912,7 +1913,7 @@ void AclOrch::doAclTableTask(Consumer &consumer)
{
KeyOpFieldsValuesTuple t = it->second;
string key = kfvKey(t);
size_t found = key.find('|');
size_t found = key.find(consumer.getConsumerTable()->getTableNameSeparator().c_str());
string table_id = key.substr(0, found);
string op = kfvOp(t);

Expand Down Expand Up @@ -1947,7 +1948,7 @@ void AclOrch::doAclTableTask(Consumer &consumer)
}
else if (attr_name == TABLE_PORTS)
{
bool suc = processPorts(attr_value, [&](sai_object_id_t portOid) {
bool suc = processPorts(newTable, attr_value, [&](sai_object_id_t portOid) {
newTable.link(portOid);
});

Expand Down Expand Up @@ -2012,7 +2013,7 @@ void AclOrch::doAclRuleTask(Consumer &consumer)
{
KeyOpFieldsValuesTuple t = it->second;
string key = kfvKey(t);
size_t found = key.find('|');
size_t found = key.find(consumer.getConsumerTable()->getTableNameSeparator().c_str());
string table_id = key.substr(0, found);
string rule_id = key.substr(found + 1);
string op = kfvOp(t);
Expand Down Expand Up @@ -2092,17 +2093,79 @@ void AclOrch::doAclRuleTask(Consumer &consumer)
}
}

bool AclOrch::processPorts(string portsList, std::function<void (sai_object_id_t)> inserter)
void AclOrch::doAclTablePortUpdateTask(Consumer &consumer)
{
SWSS_LOG_ENTER();

auto it = consumer.m_toSync.begin();
while (it != consumer.m_toSync.end())
{
KeyOpFieldsValuesTuple t = it->second;
string key = kfvKey(t);
size_t found = key.find(consumer.getConsumerTable()->getTableNameSeparator().c_str());
string port_alias = key.substr(0, found);
string op = kfvOp(t);

SWSS_LOG_INFO("doAclTablePortUpdateTask: OP: %s, port_alias: %s", op.c_str(), port_alias.c_str());

if (op == SET_COMMAND)
{
for (auto itmap : m_AclTables)
{
auto table = itmap.second;
if (table.pendingPortSet.find(port_alias) != table.pendingPortSet.end())
{
SWSS_LOG_INFO("found the port: %s in ACL table: %s pending port list, bind it to ACL table.", port_alias.c_str(), table.description.c_str());

bool suc = processPendingPort(table, port_alias, [&](sai_object_id_t portOid) {
table.link(portOid);
});

if (!suc)
{
SWSS_LOG_ERROR("Failed to bind the ACL table: %s to port: %s", table.description.c_str(), port_alias.c_str());
}
else
{
table.pendingPortSet.erase(port_alias);
SWSS_LOG_DEBUG("port: %s bound to ACL table table: %s, remove it from pending list", port_alias.c_str(), table.description.c_str());
}
}
}
}
else if (op == DEL_COMMAND)
{
for (auto itmap : m_AclTables)
{
auto table = itmap.second;
if (table.portSet.find(port_alias) != table.portSet.end())
{
/*TODO: update the ACL table after port/lag deleted*/
table.pendingPortSet.emplace(port_alias);
SWSS_LOG_INFO("Add deleted port: %s to the pending list of ACL table: %s", port_alias.c_str(), table.description.c_str());
}
}
}
else
{
SWSS_LOG_ERROR("Unknown operation type %s", op.c_str());
}
it = consumer.m_toSync.erase(it);
}
}

bool AclOrch::processPorts(AclTable &aclTable, string portsList, std::function<void (sai_object_id_t)> inserter)
{
SWSS_LOG_ENTER();

vector<string> strList;

SWSS_LOG_INFO("Processing ACL table port list %s", portsList.c_str());
SWSS_LOG_DEBUG("Processing ACL table port list %s", portsList.c_str());

split(portsList, strList, ',');

set<string> strSet(strList.begin(), strList.end());
aclTable.portSet = strSet;

if (strList.size() != strSet.size())
{
Expand All @@ -2118,33 +2181,52 @@ bool AclOrch::processPorts(string portsList, std::function<void (sai_object_id_t

for (const auto& alias : strList)
{
sai_object_id_t port_id;
Port port;
if (!gPortsOrch->getPort(alias, port))
{
SWSS_LOG_ERROR("Failed to process port. Port %s doesn't exist", alias.c_str());
return false;
SWSS_LOG_INFO("Port %s not configured yet, add it to ACL table %s pending list", alias.c_str(), aclTable.description.c_str());
aclTable.pendingPortSet.emplace(alias);
continue;
}

switch (port.m_type)
if (gPortsOrch->getAclBindPortId(alias, port_id))
{
case Port::PHY:
if (port.m_lag_member_id != SAI_NULL_OBJECT_ID)
{
SWSS_LOG_ERROR("Failed to process port. Bind table to LAG member %s is not allowed", alias.c_str());
return false;
}
inserter(port.m_port_id);
break;
case Port::LAG:
inserter(port.m_lag_id);
break;
case Port::VLAN:
inserter(port.m_vlan_info.vlan_oid);
break;
default:
SWSS_LOG_ERROR("Failed to process port. Incorrect port %s type %d", alias.c_str(), port.m_type);
return false;
}
inserter(port_id);
}
else
{
return false;
}
}

return true;
}

bool AclOrch::processPendingPort(AclTable &aclTable, string portAlias, std::function<void (sai_object_id_t)> inserter)
{
SWSS_LOG_ENTER();

SWSS_LOG_DEBUG("Processing ACL table port %s", portAlias.c_str());

sai_object_id_t port_id;

Port port;
if (!gPortsOrch->getPort(portAlias, port))
{
SWSS_LOG_INFO("Port %s not configured yet, add it to ACL table %s pending list", portAlias.c_str(), aclTable.description.c_str());
aclTable.pendingPortSet.insert(portAlias);
return true;
}

if (gPortsOrch->getAclBindPortId(portAlias, port_id))
{
inserter(port_id);
aclTable.bind(port_id);
}
else
{
return false;
}

return true;
Expand Down Expand Up @@ -2261,18 +2343,14 @@ sai_status_t AclOrch::bindAclTable(sai_object_id_t table_oid, AclTable &aclTable
sai_status_t status = SAI_STATUS_SUCCESS;

SWSS_LOG_INFO("%s table %s to ports", bind ? "Bind" : "Unbind", aclTable.id.c_str());

if (aclTable.ports.empty())
{
if (bind)
{
SWSS_LOG_ERROR("Port list is not configured for %s table", aclTable.id.c_str());
return SAI_STATUS_FAILURE;
}
else
{
return SAI_STATUS_SUCCESS;
SWSS_LOG_WARN("Binding port list is empty for %s table", aclTable.id.c_str());
}
return SAI_STATUS_SUCCESS;
}

if (bind)
Expand Down
14 changes: 10 additions & 4 deletions orchagent/aclorch.h
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,10 @@ struct AclTable {
std::map<sai_object_id_t, sai_object_id_t> ports;
// Map rule name to rule data
map<string, shared_ptr<AclRule>> rules;
// Set to store the ACL table port alias
set<string> portSet;
// Set to store the not cofigured ACL table port alias
set<string> pendingPortSet;

AclTable()
: type(ACL_TABLE_UNKNOWN)
Expand Down Expand Up @@ -348,8 +352,8 @@ inline void split(string str, Iterable& out, char delim = ' ')
class AclOrch : public Orch, public Observer
{
public:
AclOrch(DBConnector *db, vector<string> tableNames, PortsOrch *portOrch, MirrorOrch *mirrorOrch, NeighOrch *neighOrch, RouteOrch *routeOrch);
AclOrch(DBConnector *db, vector<string> tableNames, PortsOrch *portOrch, MirrorOrch *mirrorOrch, NeighOrch *neighOrch, RouteOrch *routeOrch, DTelOrch *m_dTelOrch);
AclOrch(vector<TableConnector>& connectors, PortsOrch *portOrch, MirrorOrch *mirrorOrch, NeighOrch *neighOrch, RouteOrch *routeOrch);
AclOrch(vector<TableConnector>& connectors, PortsOrch *portOrch, MirrorOrch *mirrorOrch, NeighOrch *neighOrch, RouteOrch *routeOrch, DTelOrch *m_dTelOrch);
~AclOrch();
void update(SubjectType, void *);

Expand All @@ -375,8 +379,9 @@ class AclOrch : public Orch, public Observer
void doTask(Consumer &consumer);
void doAclTableTask(Consumer &consumer);
void doAclRuleTask(Consumer &consumer);
void doAclTablePortUpdateTask(Consumer &consumer);
void doTask(SelectableTimer &timer);
void init(DBConnector *db, vector<string> tableNames, PortsOrch *portOrch, MirrorOrch *mirrorOrch, NeighOrch *neighOrch, RouteOrch *routeOrch);
void init(vector<TableConnector>& connectors, PortsOrch *portOrch, MirrorOrch *mirrorOrch, NeighOrch *neighOrch, RouteOrch *routeOrch);

static void collectCountersThread(AclOrch *pAclOrch);

Expand All @@ -386,7 +391,8 @@ class AclOrch : public Orch, public Observer

bool processAclTableType(string type, acl_table_type_t &table_type);
bool processAclTableStage(string stage, acl_stage_type_t &acl_stage);
bool processPorts(string portsList, std::function<void (sai_object_id_t)> inserter);
bool processPorts(AclTable &aclTable, string portsList, std::function<void (sai_object_id_t)> inserter);
bool processPendingPort(AclTable &aclTable, string portAlias, std::function<void (sai_object_id_t)> inserter);
bool validateAclTable(AclTable &aclTable);
sai_status_t createDTelWatchListTables();
sai_status_t deleteDTelWatchListTables();
Expand Down
Loading