Skip to content

Commit

Permalink
[swss - buffer manager] set xon_offset when available in lookup table (
Browse files Browse the repository at this point in the history
…sonic-net#443)

Signed-off-by: Ying Xie <ying.xie@microsoft.com>
  • Loading branch information
yxieca authored and lguohan committed Feb 15, 2018
1 parent 9df9722 commit da5f3d1
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
18 changes: 14 additions & 4 deletions cfgmgr/buffermgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ BufferMgr::BufferMgr(DBConnector *cfgDb, DBConnector *stateDb, string pg_lookup_
readPgProfileLookupFile(pg_lookup_file);
}

//# speed, cable, size, xon, xoff, threshold
// 40000 5m 34816 18432 16384 1
//# speed, cable, size, xon, xoff, threshold, xon_offset
// 40000 5m 34816 18432 16384 1 2496
void BufferMgr::readPgProfileLookupFile(string file)
{
SWSS_LOG_NOTICE("Read lookup configuration file...");
Expand Down Expand Up @@ -55,12 +55,17 @@ void BufferMgr::readPgProfileLookupFile(string file)
iss >> m_pgProfileLookup[speed][cable].xoff;
iss >> m_pgProfileLookup[speed][cable].threshold;

SWSS_LOG_NOTICE("PG profile for speed %s and cable %s is: size:%s, xon:%s xoff:%s th:%s",
// Not all lookup table contains xon_offset values. Set default to empty
m_pgProfileLookup[speed][cable].xon_offset = "";
iss >> m_pgProfileLookup[speed][cable].xon_offset;

SWSS_LOG_NOTICE("PG profile for speed %s and cable %s is: size:%s, xon:%s, xoff:%s, th:%s, xon_offset:%s",
speed.c_str(), cable.c_str(),
m_pgProfileLookup[speed][cable].size.c_str(),
m_pgProfileLookup[speed][cable].xon.c_str(),
m_pgProfileLookup[speed][cable].xoff.c_str(),
m_pgProfileLookup[speed][cable].threshold.c_str()
m_pgProfileLookup[speed][cable].threshold.c_str(),
m_pgProfileLookup[speed][cable].xon_offset.c_str()
);
}

Expand Down Expand Up @@ -91,6 +96,7 @@ Create/update two tables: profile (in m_cfgBufferProfileTable) and port buffer (
"pg_lossless_100G_300m_profile": {
"pool":"[BUFFER_POOL_TABLE:ingress_lossless_pool]",
"xon":"18432",
"xon_offset":"2496",
"xoff":"165888",
"size":"184320",
"dynamic_th":"1"
Expand Down Expand Up @@ -146,6 +152,10 @@ void BufferMgr::doSpeedUpdateTask(string port, string speed)
string pg_pool_reference = string(CFG_BUFFER_POOL_TABLE_NAME) + CONFIGDB_TABLE_NAME_SEPARATOR + INGRESS_LOSSLESS_PG_POOL_NAME;
fvVector.push_back(make_pair("pool", "[" + pg_pool_reference + "]"));
fvVector.push_back(make_pair("xon", m_pgProfileLookup[speed][cable].xon));
if (m_pgProfileLookup[speed][cable].xon_offset.length() > 0) {
fvVector.push_back(make_pair("xon_offset",
m_pgProfileLookup[speed][cable].xon_offset));
}
fvVector.push_back(make_pair("xoff", m_pgProfileLookup[speed][cable].xoff));
fvVector.push_back(make_pair("size", m_pgProfileLookup[speed][cable].size));
fvVector.push_back(make_pair(mode, m_pgProfileLookup[speed][cable].threshold));
Expand Down
1 change: 1 addition & 0 deletions cfgmgr/buffermgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ namespace swss {
typedef struct{
string size;
string xon;
string xon_offset;
string xoff;
string threshold;
} pg_profile_t;
Expand Down
2 changes: 1 addition & 1 deletion cfgmgr/buffermgrd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ void usage()
cout << "Usage: buffermgrd -l pg_lookup.ini" << endl;
cout << " -l pg_lookup.ini: PG profile look up table file (mandatory)" << endl;
cout << " format: csv" << endl;
cout << " values: 'speed, cable, size, xon, xoff, dynamic_threshold'" << endl;
cout << " values: 'speed, cable, size, xon, xoff, dynamic_threshold, xon_offset'" << endl;
}

int main(int argc, char **argv)
Expand Down

0 comments on commit da5f3d1

Please sign in to comment.