-
Notifications
You must be signed in to change notification settings - Fork 543
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
Dynamic transceiver tuning support #821
Conversation
orchagent/portsorch.cpp
Outdated
{ | ||
attr_id = SAI_PORT_ATTR_SERDES_IPREDRIVER; | ||
} | ||
else if(fvField(i) == "port") |
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.
Hi Sudharsan,
I am reviewing the SAI piece of this as well at Broadcom and one thing I am wondering is how you handle interface mode. Along with pre-emphasis settings, for DACs we will want to set either CR/XFI where for copper we would want to program SR/SFI. The transceiver compliance field is all we would need but that would need to get passed down to SAI to set the interface mode properly.
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.
Hi @wschwartz Currently I don't think SONiC has a mechanism to program the interface mode. This pull request is just to handle pre-emphasis related settings alone. The interface mode can later be extended in this logic or can be incorporated in some other different logic. For now without setting interface mode, the pre-emphasis settings alone work good in SONiC and if there is a future requirement we can create a new PR for the related settings.
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, it can. check this attribute. SAI_PORT_ATTR_MEDIA_TYPE
@wschwatz, do we think we can fix this media type in another PR, or it has to be this PR?
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.
Hi @lguohan @dgsudharsan I think this could be extended in the future to support interface mode in a future PR. With TH3 coming we have a new set of interface modes to support so its probably good to take time and investigate those. I think @ben-gale is working to find another reviewer as well.
orchagent/portsorch.cpp
Outdated
@@ -3166,6 +3171,46 @@ void PortsOrch::doTask(NotificationConsumer &consumer) | |||
} | |||
|
|||
sai_deserialize_free_port_oper_status_ntf(count, portoperstatus); | |||
} else if (op == "media_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.
media settings should go to standard port app db, like the admin_status in the port. I do not understand why choose the notification consumer here.
Please make sure your code style is consistent, you need to keep a space for after if.
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.
Hi Guohan,
I feel that media event is analogous to oper state notification generated by ASIC. These are from South bound APIs. If we see the oper status implementation, a notification consumer is used which is from syncd to orchagent. I used the same logic to implement this as similar to oper status. On other hand I feel admin status is application triggerd change from user.
Please let me know your views. If i still want to go ahead and implement it similar to admin status I will go ahead and update the PR.
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.
use appdb instead of notification consumer.
also since you add new function, you also need to add vs test on this. |
4c5e465
to
1fc2011
Compare
Hi @lguohan. I have added vs tests for the attributes I introduced. Below is the output of vs test test_port.py::TestPort::test_PortMtu PASSED [ 16%] ====================================================== 6 passed in 43.30 seconds ====================================================== |
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.
Look OK for me
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.
We are calling SAI API to configure serdes tuning values thru orchagent, why not thru syncd?
How we determine thru which entity to access asic? Do we have a general guidance?
Hi @stevenlu99 , The API called in orchagent actually calls the libsairedis API. This will write into ASIC_DB and which in turn messages the syncd. Syncd then deserializes the parameters and invokes the vendor specific SAI API that programs the NPU. |
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.
Looks good
orchagent/portsorch.h
Outdated
@@ -189,6 +189,12 @@ class PortsOrch : public Orch, public Subject | |||
|
|||
bool getPortOperStatus(const Port& port, sai_port_oper_status_t& status) const; | |||
void updatePortOperStatus(Port &port, sai_port_oper_status_t status); | |||
|
|||
void sai_get_port_serdes_values (const std::string& s, |
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.
( [](start = 35, length = 2)
no space here.
orchagent/portsorch.cpp
Outdated
/* Set port serdes Pre-emphasis */ | ||
if (fvField(i) == "preemphasis") | ||
{ | ||
sai_get_port_serdes_values(fvValue(i), pre_emphasis); |
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.
sai_get_port_serdes_values [](start = 20, length = 26)
app db value do not use json format. Please propose a text format and use that in the app db.
for example:
value,value
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.
please add the proposed scheme in here.
https://github.com/Azure/sonic-swss/blob/master/doc/swss-schema.md
In reply to: 282750165 [](ancestors = 282750165)
orchagent/portsorch.cpp
Outdated
@@ -22,6 +22,9 @@ | |||
#include "crmorch.h" | |||
#include "countercheckorch.h" | |||
#include "notifier.h" | |||
#include "swss/json.hpp" | |||
|
|||
using json = nlohmann::json; |
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.
do not use json for app db attribute value.
orchagent/portsorch.cpp
Outdated
@@ -1855,6 +1879,52 @@ void PortsOrch::doPortTask(Consumer &consumer) | |||
} | |||
} | |||
|
|||
if(pre_emphasis.size() != 0) |
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(p [](start = 16, length = 4)
leave space here.
Ran the test after the changes. test_port.py::TestPort::test_PortMtu PASSED [ 16%] ================================================== 6 passed in 40.25 seconds ================================================== |
fixing compilation Removing debug logs Reverting unwanted change Addressing review comments Clean up Adding vs Test cases Addressing code review comments Addressing review comment Modifying schema
retest this please |
2 similar comments
retest this please |
retest this please |
…c-net#821) Signed-off-by: Nazarii Hnydyn <nazariig@mellanox.com>
- What I did
Dynamic transceiver tuning support
- How I did it
Dynamically program pre-emphasis and other settings based on media detected in xcvrd. The various supported media are defined in media_settings.json
- How to verify it
Perform OIR of different media types. Dump the pre-emphasis values from hardware and verify that they got reflected
- Description for the changelog
Support for dynamically programming pre-emphasis
DO NOT MERGE THIS PULL REQUEST UNTIL BCM SDK SUPPORT FOR SAI PREEMPHASIS ATTRIBUTES HAVE BEEN MERGED
- A picture of a cute animal (not mandatory but encouraged)