Skip to content

Commit

Permalink
[xcvrd] Fix crash on platforms which support media settings with Pyth…
Browse files Browse the repository at this point in the history
…on 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.
  • Loading branch information
aravindmani-1 authored Mar 3, 2021
1 parent 47bcf90 commit 32ec23c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion sonic-xcvrd/xcvrd/xcvrd.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 +
Expand Down

0 comments on commit 32ec23c

Please sign in to comment.