Skip to content

Port fix from PR 3931#208

Merged
yxieca merged 2 commits intoAzure:202501from
manamand2020:port_pr3931
Jul 30, 2025
Merged

Port fix from PR 3931#208
yxieca merged 2 commits intoAzure:202501from
manamand2020:port_pr3931

Conversation

@manamand2020
Copy link

What I did

Port the fix from sonic-net/sonic-utilities#3931

How to verify it

Verified original PR on hardware.

Previous command output (if the output of a command-line utility has changed)

New command output (if the output of a command-line utility has changed)

@manamand2020 manamand2020 force-pushed the port_pr3931 branch 3 times, most recently from 0f3ef0e to 58de330 Compare July 26, 2025 02:27
Signed-off-by: Manas Kumar Mandal <manamand@cisco.com>
Copy link
Member

@lolyu lolyu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the change looks good to me, do you have data that how long does the new LUA script with nexthop read take?

Signed-off-by: Manas Kumar Mandal <manamand@cisco.com>
@manamand2020
Copy link
Author

the change looks good to me, do you have data that how long does the new LUA script with nexthop read take?
@lolyu
Nexthop table read time: 2.34 ms (with 128 v6 and 10 v4 nbr on one mux port.)

--- a/scripts/dualtor_neighbor_check.py
+++ b/scripts/dualtor_neighbor_check.py
@@ -148,6 +148,7 @@ for i, neighbor_entry in ipairs(neighbor_entries) do
 end

 -- read ASIC nexthop table
+local nexthop_start_time = redis.call('TIME')
 local nexthop_prefix = asic_state_table_name .. ASIC_DB_SEPARATOR .. 'SAI_OBJECT_TYPE_NEXT_HOP:'
 local nexthop_entries = redis.call('KEYS', nexthop_prefix .. '*')
 for i, nexthop_entry in ipairs(nexthop_entries) do
@@ -164,6 +165,9 @@ for i, nexthop_entry in ipairs(nexthop_entries) do

     asic_nexthop_table[nexthop_id] = nexthop_info
 end
+local nexthop_end_time = redis.call('TIME')
+local nexthop_duration_ms = (nexthop_end_time[1] - nexthop_start_time[1]) * 1000 +
+                           (nexthop_end_time[2] - nexthop_start_time[2]) / 1000

 local result = {}
 result['neighbors']         = neighbors
@@ -173,6 +177,7 @@ result['asic_fdb']          = asic_fdb
 result['asic_route_table']  = asic_route_table
 result['asic_neigh_table']  = asic_neighbor_table
 result['asic_nexthop_table'] = asic_nexthop_table
+result['nexthop_read_time_ms'] = nexthop_duration_ms

 return redis.status_reply(cjson.encode(result))
 """
@@ -356,6 +361,9 @@ def read_tables_from_db(appl_db):
     asic_route_table = tables["asic_route_table"]
     asic_neigh_table = tables["asic_neigh_table"]
     asic_nexthop_table = tables["asic_nexthop_table"]
+    nexthop_read_time_ms = tables.get("nexthop_read_time_ms", 0)
+
+    WRITE_LOG_INFO("Nexthop table read time: %.2f ms", nexthop_read_time_ms)
     WRITE_LOG_DEBUG("neighbors: %s", json.dumps(neighbors, indent=4))
     WRITE_LOG_DEBUG("mux states: %s", json.dumps(mux_states, indent=4))
     WRITE_LOG_DEBUG("hw mux states: %s", json.dumps(hw_mux_states, indent=4))

@yxieca yxieca merged commit fe48d70 into Azure:202501 Jul 30, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants