Skip to content

Commit ab69aa6

Browse files
committed
Replaced channel with subport
1 parent 5900348 commit ab69aa6

File tree

2 files changed

+20
-20
lines changed

2 files changed

+20
-20
lines changed

sonic-xcvrd/tests/test_xcvrd.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -713,7 +713,7 @@ def get_application(lane):
713713

714714
assert task.is_cmis_application_update_required(mock_xcvr_api, app_new, host_lanes_mask) == expected
715715

716-
@pytest.mark.parametrize("host_lane_count, speed, channel, expected", [
716+
@pytest.mark.parametrize("host_lane_count, speed, subport, expected", [
717717
(8, 400000, 0, 0xFF),
718718
(4, 100000, 1, 0xF),
719719
(4, 100000, 2, 0xF0),
@@ -722,7 +722,7 @@ def get_application(lane):
722722
(1, 50000, 2, 0x2),
723723
(1, 200000, 2, 0x0)
724724
])
725-
def test_CmisManagerTask_get_cmis_host_lanes_mask(self, host_lane_count, speed, channel, expected):
725+
def test_CmisManagerTask_get_cmis_host_lanes_mask(self, host_lane_count, speed, subport, expected):
726726
appl_advert_dict = {
727727
1: {
728728
'host_electrical_interface_id': '400GAUI-8 C2M (Annex 120E)',
@@ -757,7 +757,7 @@ def get_host_lane_assignment_option_side_effect(app):
757757
task = CmisManagerTask(DEFAULT_NAMESPACE, port_mapping, stop_event)
758758

759759
appl = task.get_cmis_application_desired(mock_xcvr_api, host_lane_count, speed)
760-
assert task.get_cmis_host_lanes_mask(mock_xcvr_api, appl, host_lane_count, channel) == expected
760+
assert task.get_cmis_host_lanes_mask(mock_xcvr_api, appl, host_lane_count, subport) == expected
761761

762762
@patch('xcvrd.xcvrd.platform_chassis')
763763
@patch('xcvrd.xcvrd_utilities.port_mapping.subscribe_port_update_event', MagicMock(return_value=(None, None)))

sonic-xcvrd/xcvrd/xcvrd.py

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1023,8 +1023,8 @@ def on_port_update_event(self, port_change_event):
10231023
self.port_dict[lport]['laser_freq'] = int(port_change_event.port_dict['laser_freq'])
10241024
if 'tx_power' in port_change_event.port_dict:
10251025
self.port_dict[lport]['tx_power'] = float(port_change_event.port_dict['tx_power'])
1026-
if 'channel' in port_change_event.port_dict:
1027-
self.port_dict[lport]['channel'] = int(port_change_event.port_dict['channel'])
1026+
if 'subport' in port_change_event.port_dict:
1027+
self.port_dict[lport]['subport'] = int(port_change_event.port_dict['subport'])
10281028

10291029
self.force_cmis_reinit(lport, 0)
10301030
else:
@@ -1097,9 +1097,9 @@ def get_cmis_dp_init_duration_secs(self, api):
10971097
def get_cmis_dp_deinit_duration_secs(self, api):
10981098
return api.get_datapath_deinit_duration()/1000
10991099

1100-
def get_cmis_host_lanes_mask(self, api, appl, host_lane_count, channel):
1100+
def get_cmis_host_lanes_mask(self, api, appl, host_lane_count, subport):
11011101
"""
1102-
Retrieves mask of active host lanes based on appl, host lane count and channel
1102+
Retrieves mask of active host lanes based on appl, host lane count and subport
11031103
11041104
Args:
11051105
api:
@@ -1108,8 +1108,8 @@ def get_cmis_host_lanes_mask(self, api, appl, host_lane_count, channel):
11081108
Integer, the transceiver-specific application code
11091109
host_lane_count:
11101110
Integer, number of lanes on the host side
1111-
channel:
1112-
Integer, channel id of the group which the host lanes belong to (1 based),
1111+
subport:
1112+
Integer, subport id of the group which the host lanes belong to (1 based),
11131113
0 means port is a non-breakout port
11141114
11151115
Returns:
@@ -1118,20 +1118,20 @@ def get_cmis_host_lanes_mask(self, api, appl, host_lane_count, channel):
11181118
"""
11191119
host_lanes_mask = 0
11201120

1121-
if appl < 1 or host_lane_count <= 0 or channel < 0:
1121+
if appl < 1 or host_lane_count <= 0 or subport < 0:
11221122
self.log_error("Invalid input to get host lane mask - appl {} host_lane_count {} "
1123-
"channel {}!".format(appl, host_lane_count, channel))
1123+
"subport {}!".format(appl, host_lane_count, subport))
11241124
return host_lanes_mask
11251125

11261126
host_lane_assignment_option = api.get_host_lane_assignment_option(appl)
1127-
host_lane_start_bit = (host_lane_count * (0 if channel == 0 else channel - 1))
1127+
host_lane_start_bit = (host_lane_count * (0 if subport == 0 else subport - 1))
11281128
if host_lane_assignment_option & (1 << host_lane_start_bit):
11291129
host_lanes_mask = ((1 << host_lane_count) - 1) << host_lane_start_bit
11301130
else:
11311131
self.log_error("Unable to find starting host lane - host_lane_assignment_option {}"
1132-
" host_lane_start_bit {} host_lane_count {} channel {} appl {}!".format(
1132+
" host_lane_start_bit {} host_lane_count {} subport {} appl {}!".format(
11331133
host_lane_assignment_option, host_lane_start_bit, host_lane_count,
1134-
channel, appl))
1134+
subport, appl))
11351135

11361136
return host_lanes_mask
11371137

@@ -1360,7 +1360,7 @@ def configure_laser_frequency(self, api, lport, freq, grid=75):
13601360
if chan % 3 != 0:
13611361
self.log_error("{} configured freq:{} GHz is NOT in 75GHz grid".format(lport, freq))
13621362
if api.get_tuning_in_progress():
1363-
self.log_error("{} Tuning in progress, channel selection may fail!".format(lport))
1363+
self.log_error("{} Tuning in progress, subport selection may fail!".format(lport))
13641364
return api.set_laser_freq(freq, grid)
13651365

13661366
def wait_for_port_config_done(self, namespace):
@@ -1429,8 +1429,8 @@ def task_worker(self):
14291429
pport = int(info.get('index', "-1"))
14301430
speed = int(info.get('speed', "0"))
14311431
lanes = info.get('lanes', "").strip()
1432-
channel = info.get('channel', 0)
1433-
if pport < 0 or speed == 0 or len(lanes) < 1 or channel < 0:
1432+
subport = info.get('subport', 0)
1433+
if pport < 0 or speed == 0 or len(lanes) < 1 or subport < 0:
14341434
continue
14351435

14361436
# Desired port speed on the host side
@@ -1511,10 +1511,10 @@ def task_worker(self):
15111511
self.log_notice("{}: Setting appl={}".format(lport, appl))
15121512

15131513
self.port_dict[lport]['host_lanes_mask'] = self.get_cmis_host_lanes_mask(api,
1514-
appl, host_lane_count, channel)
1514+
appl, host_lane_count, subport)
15151515
if self.port_dict[lport]['host_lanes_mask'] <= 0:
1516-
self.log_error("{}: Invalid lane mask received - host_lane_count {} channel {} "
1517-
"appl {}!".format(lport, host_lane_count, channel, appl))
1516+
self.log_error("{}: Invalid lane mask received - host_lane_count {} subport {} "
1517+
"appl {}!".format(lport, host_lane_count, subport, appl))
15181518
self.port_dict[lport]['cmis_state'] = self.CMIS_STATE_FAILED
15191519
continue
15201520
host_lanes_mask = self.port_dict[lport]['host_lanes_mask']

0 commit comments

Comments
 (0)