From 32ec23c2e9e18b3eed8f313f3028e62395e53cef Mon Sep 17 00:00:00 2001 From: Aravind Mani <53524901+aravindmani-1@users.noreply.github.com> Date: Wed, 3 Mar 2021 08:39:37 +0530 Subject: [PATCH] [xcvrd] Fix crash on platforms which support media settings with Python 3 (#158) xcvrd would crash on platforms which support media settings with Python 3 because division would result in a float rather than an int. Fix using floor division. --- sonic-xcvrd/xcvrd/xcvrd.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sonic-xcvrd/xcvrd/xcvrd.py b/sonic-xcvrd/xcvrd/xcvrd.py index 750a385148aa..516e415dba56 100644 --- a/sonic-xcvrd/xcvrd/xcvrd.py +++ b/sonic-xcvrd/xcvrd/xcvrd.py @@ -679,7 +679,7 @@ def get_media_val_str(num_logical_ports, lane_dict, logical_idx): media_val_str = '' if (num_logical_ports > 1) and \ (num_lanes_on_port >= num_logical_ports): - num_lanes_per_logical_port = num_lanes_on_port/num_logical_ports + num_lanes_per_logical_port = num_lanes_on_port//num_logical_ports start_lane = logical_idx * num_lanes_per_logical_port for lane_idx in range(start_lane, start_lane +