Skip to content

Commit 32ec23c

Browse files
[xcvrd] Fix crash on platforms which support media settings with Python 3 (sonic-net#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.
1 parent 47bcf90 commit 32ec23c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

sonic-xcvrd/xcvrd/xcvrd.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -679,7 +679,7 @@ def get_media_val_str(num_logical_ports, lane_dict, logical_idx):
679679
media_val_str = ''
680680
if (num_logical_ports > 1) and \
681681
(num_lanes_on_port >= num_logical_ports):
682-
num_lanes_per_logical_port = num_lanes_on_port/num_logical_ports
682+
num_lanes_per_logical_port = num_lanes_on_port//num_logical_ports
683683
start_lane = logical_idx * num_lanes_per_logical_port
684684

685685
for lane_idx in range(start_lane, start_lane +

0 commit comments

Comments
 (0)