-
Notifications
You must be signed in to change notification settings - Fork 195
Fix port SI setting per speed during speed change #649
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @pavannaregundi I would suggest to use a port re-creation approach so that Xcvrd can delete the OLD port and create the new PORT even if only port speed attribute is changed. There are other attributes like lanes, fec etc which may be different with new speed. So a cleaner approach is to delete the old port from config DB. This way, when the new PORT is created, Xcvrd should publish the SI settings accordingly as here:-
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @prgeor This change is only about speed change - "config interface speed interface speed". Where current code is treating speed change as update to config DB. This is not a delete and create operation. Port delete and create in config db for speed change will be much bigger change. https://github.com/sonic-net/SONiC/blob/master/doc/port-si/Port_SI_Per_Speed.md HLD has this statement in this regard - "After applying the port SI per speed enhancements, it will also be carried out upon port speed change events: Whenever a port speed change is detected by listening to CONFIG_DB, Notify-Media-Settings-Process will be called to send the most applicable SI values in the JSON to SAI. Port speed changes require invoking the Notify-Media-Settings-Process becuase after such a change, the lane_speed_key used for lookup in the JSON changes accordingly, and the previously configured SI values in the ASIC are no longer relevant." Number of lane change does happen only if there is a breakout and it will automatically trigger a port delete and port add even for CONFIG_DB. So it will end up with delete and add for xcvrd too. (SAI_PORT_ATTR_HW_LANE_LIST in sai is a create only attribute.)
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @pavannaregundi The HLD can be updated to what I mentioned. Dont want to invent the wheel for each of the following scenarios. I would like to fix it one for all.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @pavannaregundi I don't know what you mean by bigger change. During breakout of the port speed, we delete the old port and create the new port anyways. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -225,6 +225,13 @@ def __init__(self): | |
| self.physical_to_logical = {} | ||
| # Logical port name to ASIC ID mapping | ||
| self.logical_to_asic = {} | ||
| self.port_event_cache = {} | ||
|
|
||
| def apply_filter_to_fvp(self, filter, fvp): | ||
| if filter is not None: | ||
| for key in fvp.copy().keys(): | ||
| if key not in (set(filter) | set({'index', 'port_name', 'asic_id'})): | ||
| del fvp[key] | ||
|
|
||
| def handle_port_change_event(self, port_change_event): | ||
| if port_change_event.event_type == PortChangeEvent.PORT_ADD: | ||
|
|
@@ -313,6 +320,12 @@ def read_port_config_change(asic_context, port_mapping, logger, port_change_even | |
| fvp = dict(fvp) | ||
| if not multi_asic.is_front_panel_port(key, fvp.get(multi_asic.PORT_ROLE, None)): | ||
| continue | ||
|
|
||
| fvp['port_name'] = key | ||
| fvp['asic_id'] = asic_context[port_tbl] | ||
| filter = ['speed'] | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. One concern here: Consider the following settings: If the breakout goes from Ethernet0 400G-8 (using Copper50 tuning values) to 2x400G-4 (Copper100 values) I think that event will be missed based on speed alone, the number of lanes should also be a factor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @bobby-nexthop Thank you for review. Number of lane change only happens due to port breakout and breakout triggers a port remove and add. This scenario already works as, PORT ADD and PORT REMOVE is taken care with existing code base. We do see a error w.r.t NPU_SI_SETTINGS_SYNC_STATUS and this change is already there for review with PR #622 |
||
| port_mapping.apply_filter_to_fvp(filter, fvp) | ||
|
|
||
| if op == swsscommon.SET_COMMAND: | ||
| if 'index' not in fvp: | ||
| continue | ||
|
|
@@ -333,6 +346,15 @@ def read_port_config_change(asic_context, port_mapping, logger, port_change_even | |
|
|
||
| port_change_event = PortChangeEvent(key, new_physical_index, asic_context[port_tbl], PortChangeEvent.PORT_ADD) | ||
| port_change_event_handler(port_change_event) | ||
| else: | ||
| if key in port_mapping.port_event_cache: | ||
| # Compare current event with last event on this key, to see if | ||
| # there's really a need to update. | ||
| diff = set(fvp.items()) - set(port_mapping.port_event_cache[key].items()) | ||
| # Create set event handler if there is a difference | ||
| if diff: | ||
| port_change_event = PortChangeEvent(key, new_physical_index, asic_context[port_tbl], PortChangeEvent.PORT_SET) | ||
| port_change_event_handler(port_change_event) | ||
| elif op == swsscommon.DEL_COMMAND: | ||
| if port_mapping.is_logical_port(key): | ||
| port_change_event = PortChangeEvent(key, | ||
|
|
@@ -343,6 +365,9 @@ def read_port_config_change(asic_context, port_mapping, logger, port_change_even | |
| else: | ||
| logger.log_warning('Invalid DB operation: {}'.format(op)) | ||
|
|
||
| # Update the latest event to the cache | ||
| port_mapping.port_event_cache[key] = fvp | ||
|
|
||
| def get_port_mapping(namespaces): | ||
| """Get port mapping from CONFIG_DB | ||
| """ | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pavannaregundi How are we ensuring
NPU_SI_SETTINGS_SYNC_STATUS_KEYis set properly? @mihirpat1 FYIAlso, does the CmisManager reinitialize the port on speed change only after ensuring the following? Do you have the log to confirm?
host_tx_readybetween swss and xcvrdUh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@prgeor Please find my answers inline. Also please refer to the logs
media_settings_with_speed_change_log.txt.txt
These logs are taken with following command,
NPU_SI_SETTINGS_SYNC_STATUS_KEY is always set to NPU_SI_SETTINGS_DEFAULT_VALUE in on_update_logical_port() before calling notify_media_setting(), to make sure serdes values are newly calculated as per the current port speed. Finally it is set to NPU_SI_SETTINGS_NOTIFIED_VALUE by notify_media_setting() which indicates the serdes values are notified. State db dump of the ports under tests are attached in logs file to show value is NPU_SI_SETTINGS_NOTIFIED_VALUE.
In attached log file, sairedis.logs shows that old serdes object is removed and new values are applied to syncd SAI SDK. Media setting values are same as the one shown in the issue sonic-net/sonic-buildimage#23480
In attached log file, sairedis.log/syslog show 'SAI_PORT_HOST_TX_READY_STATUS_READY' and corresponding 'host_tx_ready' in swss#orchagent. Also indicates CMIS reinit after host_tx_ready set to 'true'.