-
Notifications
You must be signed in to change notification settings - Fork 563
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
[orchagent]: Enhance initSaiPhyApi #2367
[orchagent]: Enhance initSaiPhyApi #2367
Conversation
The SAI_SWITCH_ATTR_SWITCH_HARDWARE_INFO formatting is vendor specific. * Remove the formating check that assumes its of the mdio sysfs format * Note the the count remains without including the NULL termintor, which is not compliant with the SAI header definintion that indicates a NULL terminated string. Signed-off-by: aaronp@arista.com
Some external phys do not support Firmware upgrades and therefore do not have a firmware version. The SAI_SWITCH_ATTR_FIRMWARE_MAJOR_VERSION may return SAI_STATUS_ATTR_NOT_SUPPORTED which needs to be gracefully supported and allow the phy to be created. * Allow SAI_STATUS_NOT_SUPPORTED return value and set version to empty string. Signed-off-by: Aaron Payment <aaronp@arista.com>
orchagent/saihelper.cpp
Outdated
if (status == SAI_STATUS_SUCCESS) { | ||
phy->firmware_major_version = string(attr.value.chardata); | ||
} else if( status == SAI_STATUS_NOT_SUPPORTED ) { | ||
phy->firmware_major_version = ""; |
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.
I am not sure the empty string is good enough here. Should it be "N/A" or "Not Supported"?
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.
I'm fine with changing it to N/A. I don't think there are any strict requirements here.
orchagent/saihelper.cpp
Outdated
{ | ||
if (status == SAI_STATUS_SUCCESS) { | ||
phy->firmware_major_version = string(attr.value.chardata); | ||
} else if( status == SAI_STATUS_NOT_SUPPORTED ) { |
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.
Should this be handled in vendor SAI instead of swss?
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.
Vendor SAI will handle returning the appropriate status and setting the attr variable appropriately, and swss will update the local phy object appropriately. I'm not sure I understand why the responsibilities would need to change.
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.
If we do this change in swss, it would change the behavior for all platforms. However, BCM54182(or a few limited platforms) is the only platform that requires this change. That is why I thought it should be vendor SAI's responsibility to do so.
Anyway, if this change has no harm to other platforms, I can live with it. I don't have strong opinion here.
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.
Yes, this should not affect other platforms if they are still returning SAI_STATUS_FAILURE. But I think the change here is appropriate to allow initSaiPhyApi to return with success on platforms that don't support firmware.
/azp run Azure.sonic-swss |
Commenter does not have sufficient privileges for PR 2367 in repo Azure/sonic-swss |
Can someone with sufficient privileges rerun the tests? The errors do not look related. |
Try |
/azpw run Azure.sonic-swss |
I opened #2383 to revert the change here that increases the hwinfo count |
What I did Revert change from #2367 which increases count associated with SAI_SWITCH_ATTR_SWITCH_HARDWARE_INFO by 1, as well as the memset. Why I did it Original intention of this change was to accommodate sairedis behaviour when copying null-terminated string; original behaviour is that the null-terminator would not be copied and so receiver of the hwinfo (PAI) would see non-null terminated string. Reverting this change so that old behaviour is maintained and PAI driver is responsible for not relying on string to be null terminated.
* Add support for generic hwinfo string in gearbox_config.json The SAI_SWITCH_ATTR_SWITCH_HARDWARE_INFO formatting is vendor specific. * Remove the formating check that assumes its of the mdio sysfs format * Note the the count remains without including the NULL termintor, which is not compliant with the SAI header definintion that indicates a NULL terminated string. Signed-off-by: aaronp@arista.com * Add support to allow Firmware Major Version to return unsupported" Some external phys do not support Firmware upgrades and therefore do not have a firmware version. The SAI_SWITCH_ATTR_FIRMWARE_MAJOR_VERSION may return SAI_STATUS_ATTR_NOT_SUPPORTED which needs to be gracefully supported and allow the phy to be created. * Allow SAI_STATUS_NOT_SUPPORTED return value and set version to empty string. Signed-off-by: Aaron Payment <aaronp@arista.com> * Address review comments * Address review comments, fix hwinfo Co-authored-by: Aaron Payment <aaronp@arista.com>
* Add support for generic hwinfo string in gearbox_config.json The SAI_SWITCH_ATTR_SWITCH_HARDWARE_INFO formatting is vendor specific. * Remove the formating check that assumes its of the mdio sysfs format * Note the the count remains without including the NULL termintor, which is not compliant with the SAI header definintion that indicates a NULL terminated string. Signed-off-by: aaronp@arista.com * Add support to allow Firmware Major Version to return unsupported" Some external phys do not support Firmware upgrades and therefore do not have a firmware version. The SAI_SWITCH_ATTR_FIRMWARE_MAJOR_VERSION may return SAI_STATUS_ATTR_NOT_SUPPORTED which needs to be gracefully supported and allow the phy to be created. * Allow SAI_STATUS_NOT_SUPPORTED return value and set version to empty string. Signed-off-by: Aaron Payment <aaronp@arista.com> * Address review comments * Address review comments, fix hwinfo Co-authored-by: Aaron Payment <aaronp@arista.com>
What I did Revert change from sonic-net#2367 which increases count associated with SAI_SWITCH_ATTR_SWITCH_HARDWARE_INFO by 1, as well as the memset. Why I did it Original intention of this change was to accommodate sairedis behaviour when copying null-terminated string; original behaviour is that the null-terminator would not be copied and so receiver of the hwinfo (PAI) would see non-null terminated string. Reverting this change so that old behaviour is maintained and PAI driver is responsible for not relying on string to be null terminated.
What I did Revert change from #2367 which increases count associated with SAI_SWITCH_ATTR_SWITCH_HARDWARE_INFO by 1, as well as the memset. Why I did it Original intention of this change was to accommodate sairedis behaviour when copying null-terminated string; original behaviour is that the null-terminator would not be copied and so receiver of the hwinfo (PAI) would see non-null terminated string. Reverting this change so that old behaviour is maintained and PAI driver is responsible for not relying on string to be null terminated.
What I did
Why I did it
How I verified it
Tested on Arista platform with BCM54182 and appropriate PAI driver
Details if related