Skip to content

Commit 3bb7180

Browse files
Merge branch 'master' into master-dash-merge
2 parents 574940d + aabe741 commit 3bb7180

3 files changed

Lines changed: 29 additions & 2 deletions

File tree

cfgmgr/buffer_check_headroom_mellanox.lua

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,12 +82,25 @@ local function get_number_of_pgs(keyname)
8282
return size
8383
end
8484

85+
-- Fetch all the pending removing PGs
86+
local pending_remove_pg_keys = redis.call('SMEMBERS', 'BUFFER_PG_TABLE_DEL_SET')
87+
local pending_remove_pg_set = {}
88+
for i = 1, #pending_remove_pg_keys do
89+
pending_remove_pg_set['BUFFER_PG_TABLE:' .. pending_remove_pg_keys[i]] = true
90+
table.insert(debuginfo, 'debug:pending remove entry found: ' .. 'BUFFER_PG_TABLE:' .. pending_remove_pg_keys[i])
91+
end
92+
8593
-- Fetch all the PGs in APPL_DB, and store them into a hash table
94+
-- But skip the items that are in pending_remove_pg_set
8695
local pg_keys = redis.call('KEYS', 'BUFFER_PG_TABLE:' .. port .. ':*')
8796
local all_pgs = {}
8897
for i = 1, #pg_keys do
89-
local profile = redis.call('HGET', pg_keys[i], 'profile')
90-
all_pgs[pg_keys[i]] = profile
98+
if not pending_remove_pg_set[pg_keys[i]] then
99+
local profile = redis.call('HGET', pg_keys[i], 'profile')
100+
all_pgs[pg_keys[i]] = profile
101+
else
102+
table.insert(debuginfo, 'debug:pending remove entry skipped: ' .. pg_keys[i])
103+
end
91104
end
92105

93106
-- Fetch all the pending PGs, and store them into the hash table

cfgmgr/buffer_headroom_mellanox.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ local ret = {}
3939
-- the key of table pause_quanta_per_speed is operating speed at Mb/s
4040
-- the value of table pause_quanta_per_speed is the number of pause_quanta
4141
local pause_quanta_per_speed = {}
42+
pause_quanta_per_speed[800000] = 905
4243
pause_quanta_per_speed[400000] = 905
4344
pause_quanta_per_speed[200000] = 453
4445
pause_quanta_per_speed[100000] = 394

tests/test_buffer_dynamic.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -833,6 +833,19 @@ def test_bufferPortMaxParameter(self, dvs, testlog):
833833
profile_fvs['xoff'] = '9216'
834834
self.config_db.update_entry('BUFFER_PROFILE', 'test', profile_fvs)
835835
self.app_db.wait_for_field_match('BUFFER_PROFILE_TABLE', 'test', profile_fvs)
836+
837+
# Verify a pending remove PG is not counted into the accumulative headroom
838+
dvs.runcmd("kill -s SIGSTOP {}".format(oa_pid))
839+
840+
self.config_db.delete_entry('BUFFER_PG', 'Ethernet0|3-4')
841+
# Should be added because PG 3-4 has been removed and there are sufficient headroom
842+
self.config_db.update_entry('BUFFER_PG', 'Ethernet0|1', {'profile': 'ingress_lossy_profile'})
843+
844+
# Resume orchagent
845+
dvs.runcmd("kill -s SIGCONT {}".format(oa_pid))
846+
847+
# Check whether BUFFER_PG_TABLE is updated as expected
848+
self.app_db.wait_for_field_match("BUFFER_PG_TABLE", "Ethernet0:1", {"profile": "ingress_lossy_profile"})
836849
finally:
837850
dvs.runcmd("kill -s SIGCONT {}".format(oa_pid))
838851

0 commit comments

Comments
 (0)