Skip to content

Commit 652ec0e

Browse files
prsunnydaall
authored andcommitted
Revert "[buffermgr] Support maximum port headroom checking (#1607)" (#1675)
This reverts commit 189a964.
1 parent 5159a33 commit 652ec0e

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
@@ -110,7 +110,6 @@ class Port
110110
uint32_t m_vnid = VNID_NONE;
111111
uint32_t m_fdb_count = 0;
112112
uint32_t m_up_member_count = 0;
113-
uint32_t m_maximum_headroom = 0;
114113

115114
/*
116115
* Following two bit vectors are used to lock

orchagent/portsorch.cpp

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

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

270267
string queueWmSha, pgWmSha;
@@ -3293,25 +3290,6 @@ void PortsOrch::initializePriorityGroups(Port &port)
32933290
SWSS_LOG_INFO("Get priority groups for port %s", port.m_alias.c_str());
32943291
}
32953292

3296-
void PortsOrch::initializePortMaximumHeadroom(Port &port)
3297-
{
3298-
sai_attribute_t attr;
3299-
3300-
attr.id = SAI_PORT_ATTR_QOS_MAXIMUM_HEADROOM_SIZE;
3301-
3302-
sai_status_t status = sai_port_api->get_port_attribute(port.m_port_id, 1, &attr);
3303-
if (status != SAI_STATUS_SUCCESS)
3304-
{
3305-
SWSS_LOG_NOTICE("Unable to get the maximum headroom for port %s rv:%d, ignored", port.m_alias.c_str(), status);
3306-
return;
3307-
}
3308-
3309-
vector<FieldValueTuple> fvVector;
3310-
port.m_maximum_headroom = attr.value.u32;
3311-
fvVector.emplace_back("max_headroom_size", to_string(port.m_maximum_headroom));
3312-
m_stateBufferMaximumValueTable->set(port.m_alias, fvVector);
3313-
}
3314-
33153293
bool PortsOrch::initializePort(Port &port)
33163294
{
33173295
SWSS_LOG_ENTER();
@@ -3320,7 +3298,6 @@ bool PortsOrch::initializePort(Port &port)
33203298

33213299
initializePriorityGroups(port);
33223300
initializeQueues(port);
3323-
initializePortMaximumHeadroom(port);
33243301

33253302
/* Create host interface */
33263303
if (!addHostIntfs(port, port.m_alias, port.m_hif_id))

orchagent/portsorch.h

-3
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,6 @@ class PortsOrch : public Orch, public Subject
150150
unique_ptr<Table> m_pgTable;
151151
unique_ptr<Table> m_pgPortTable;
152152
unique_ptr<Table> m_pgIndexTable;
153-
unique_ptr<Table> m_stateBufferMaximumValueTable;
154153
unique_ptr<ProducerTable> m_flexCounterTable;
155154
unique_ptr<ProducerTable> m_flexCounterGroupTable;
156155

@@ -161,7 +160,6 @@ class PortsOrch : public Orch, public Subject
161160

162161
shared_ptr<DBConnector> m_counter_db;
163162
shared_ptr<DBConnector> m_flex_db;
164-
shared_ptr<DBConnector> m_state_db;
165163

166164
FlexCounterManager port_stat_manager;
167165
FlexCounterManager port_buffer_drop_stat_manager;
@@ -224,7 +222,6 @@ class PortsOrch : public Orch, public Subject
224222

225223
bool initializePort(Port &port);
226224
void initializePriorityGroups(Port &port);
227-
void initializePortMaximumHeadroom(Port &port);
228225
void initializeQueues(Port &port);
229226

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

0 commit comments

Comments
 (0)