Skip to content

Commit 4c4a3a9

Browse files
prsunnyraphaelt-nvidia
authored andcommitted
Revert "[buffermgr] Support maximum port headroom checking (sonic-net#1607)" (sonic-net#1675)
This reverts commit 189a964.
1 parent 3e7d385 commit 4c4a3a9

File tree

4 files changed

+26
-29
lines changed

4 files changed

+26
-29
lines changed

cfgmgr/buffer_check_headroom_mellanox.lua

+26-2
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,36 @@ local new_pg = ARGV[3]
1010
local accumulative_size = 0
1111

1212
local appl_db = "0"
13+
local config_db = "4"
1314
local state_db = "6"
1415

1516
local ret_true = {}
17+
local ret_false = {}
1618
local ret = {}
1719
local default_ret = {}
1820

1921
table.insert(ret_true, "result:true")
22+
table.insert(ret_false, "result:false")
2023

21-
default_ret = ret_true
24+
-- Fetch the cable length from CONFIG_DB
25+
redis.call('SELECT', config_db)
26+
local cable_length_keys = redis.call('KEYS', 'CABLE_LENGTH*')
27+
if #cable_length_keys == 0 then
28+
return ret_true
29+
end
30+
31+
-- Check whether cable length exceeds 300m (maximum value in the non-dynamic-buffer solution)
32+
local cable_length_str = redis.call('HGET', cable_length_keys[1], port)
33+
if cable_length_str == nil then
34+
return ret_true
35+
end
36+
local cable_length = tonumber(string.sub(cable_length_str, 1, -2))
37+
if cable_length > 300 then
38+
default_ret = ret_false
39+
else
40+
default_ret = ret_true
41+
end
42+
table.insert(default_ret, 'debug:no max_headroom_size configured, check cable length instead')
2243

2344
local speed = redis.call('HGET', 'PORT|' .. port, 'speed')
2445

@@ -46,6 +67,7 @@ local function get_number_of_pgs(keyname)
4667
local range = string.match(keyname, "Ethernet%d+:([^%s]+)$")
4768
local size
4869
if range == nil then
70+
table.insert(debuginfo, "debug:invalid pg:" .. keyname)
4971
return 0
5072
end
5173
if string.len(range) == 1 then
@@ -97,9 +119,11 @@ if max_headroom_size > accumulative_size then
97119
table.insert(ret, "result:true")
98120
else
99121
table.insert(ret, "result:false")
100-
table.insert(ret, "debug:Accumulative headroom on port " .. accumulative_size .. " exceeds the maximum available headroom which is " .. max_headroom_size)
101122
end
102123

124+
table.insert(ret, "debug:max headroom:" .. max_headroom_size)
125+
table.insert(ret, "debug:accumulative headroom:" .. accumulative_size)
126+
103127
for i = 1, #debuginfo do
104128
table.insert(ret, debuginfo[i])
105129
end

orchagent/port.h

-1
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,6 @@ class Port
124124
uint32_t m_vnid = VNID_NONE;
125125
uint32_t m_fdb_count = 0;
126126
uint32_t m_up_member_count = 0;
127-
uint32_t m_maximum_headroom = 0;
128127

129128
/*
130129
* Following two bit vectors are used to lock

orchagent/portsorch.cpp

-23
Original file line numberDiff line numberDiff line change
@@ -263,9 +263,6 @@ PortsOrch::PortsOrch(DBConnector *db, vector<table_name_with_pri_t> &tableNames)
263263
m_flexCounterTable = unique_ptr<ProducerTable>(new ProducerTable(m_flex_db.get(), FLEX_COUNTER_TABLE));
264264
m_flexCounterGroupTable = unique_ptr<ProducerTable>(new ProducerTable(m_flex_db.get(), FLEX_COUNTER_GROUP_TABLE));
265265

266-
m_state_db = shared_ptr<DBConnector>(new DBConnector("STATE_DB", 0));
267-
m_stateBufferMaximumValueTable = unique_ptr<Table>(new Table(m_state_db.get(), STATE_BUFFER_MAXIMUM_VALUE_TABLE));
268-
269266
initGearbox();
270267

271268
string queueWmSha, pgWmSha;
@@ -3325,25 +3322,6 @@ void PortsOrch::initializePriorityGroups(Port &port)
33253322
SWSS_LOG_INFO("Get priority groups for port %s", port.m_alias.c_str());
33263323
}
33273324

3328-
void PortsOrch::initializePortMaximumHeadroom(Port &port)
3329-
{
3330-
sai_attribute_t attr;
3331-
3332-
attr.id = SAI_PORT_ATTR_QOS_MAXIMUM_HEADROOM_SIZE;
3333-
3334-
sai_status_t status = sai_port_api->get_port_attribute(port.m_port_id, 1, &attr);
3335-
if (status != SAI_STATUS_SUCCESS)
3336-
{
3337-
SWSS_LOG_NOTICE("Unable to get the maximum headroom for port %s rv:%d, ignored", port.m_alias.c_str(), status);
3338-
return;
3339-
}
3340-
3341-
vector<FieldValueTuple> fvVector;
3342-
port.m_maximum_headroom = attr.value.u32;
3343-
fvVector.emplace_back("max_headroom_size", to_string(port.m_maximum_headroom));
3344-
m_stateBufferMaximumValueTable->set(port.m_alias, fvVector);
3345-
}
3346-
33473325
bool PortsOrch::initializePort(Port &port)
33483326
{
33493327
SWSS_LOG_ENTER();
@@ -3352,7 +3330,6 @@ bool PortsOrch::initializePort(Port &port)
33523330

33533331
initializePriorityGroups(port);
33543332
initializeQueues(port);
3355-
initializePortMaximumHeadroom(port);
33563333

33573334
/* Create host interface */
33583335
if (!addHostIntfs(port, port.m_alias, port.m_hif_id))

orchagent/portsorch.h

-3
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,6 @@ class PortsOrch : public Orch, public Subject
155155
unique_ptr<Table> m_pgTable;
156156
unique_ptr<Table> m_pgPortTable;
157157
unique_ptr<Table> m_pgIndexTable;
158-
unique_ptr<Table> m_stateBufferMaximumValueTable;
159158
unique_ptr<ProducerTable> m_flexCounterTable;
160159
unique_ptr<ProducerTable> m_flexCounterGroupTable;
161160

@@ -166,7 +165,6 @@ class PortsOrch : public Orch, public Subject
166165

167166
shared_ptr<DBConnector> m_counter_db;
168167
shared_ptr<DBConnector> m_flex_db;
169-
shared_ptr<DBConnector> m_state_db;
170168

171169
FlexCounterManager port_stat_manager;
172170
FlexCounterManager port_buffer_drop_stat_manager;
@@ -229,7 +227,6 @@ class PortsOrch : public Orch, public Subject
229227

230228
bool initializePort(Port &port);
231229
void initializePriorityGroups(Port &port);
232-
void initializePortMaximumHeadroom(Port &port);
233230
void initializeQueues(Port &port);
234231

235232
bool addHostIntfs(Port &port, string alias, sai_object_id_t &host_intfs_id);

0 commit comments

Comments
 (0)