Skip to content
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

Merged
merged 1 commit into from
Jun 4, 2019
Merged

Conversation

dgsudharsan
Copy link
Collaborator

- 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)

{
attr_id = SAI_PORT_ATTR_SERDES_IPREDRIVER;
}
else if(fvField(i) == "port")

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.

Copy link
Collaborator Author

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.

Copy link
Contributor

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?

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.

@@ -3166,6 +3171,46 @@ void PortsOrch::doTask(NotificationConsumer &consumer)
}

sai_deserialize_free_port_oper_status_ntf(count, portoperstatus);
} else if (op == "media_change") {
Copy link
Contributor

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.

Copy link
Collaborator Author

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.

Copy link
Contributor

@lguohan lguohan left a 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.

@lguohan
Copy link
Contributor

lguohan commented Apr 24, 2019

also since you add new function, you also need to add vs test on this.

@dgsudharsan dgsudharsan force-pushed the dgpreemp branch 2 times, most recently from 4c5e465 to 1fc2011 Compare April 27, 2019 03:50
@dgsudharsan
Copy link
Collaborator Author

Hi @lguohan. I have added vs tests for the attributes I introduced. Below is the output of vs test
sudo pytest -s -v --dvsname=vs test_port.py
========================================================= test session starts =========================================================
platform linux2 -- Python 2.7.15rc1, pytest-3.3.0, py-1.8.0, pluggy-0.6.0 -- /usr/bin/python
cachedir: .cache
rootdir: /home/admin/code/sonic-swss/tests, inifile:
collected 6 items

test_port.py::TestPort::test_PortMtu PASSED [ 16%]
test_port.py::test_PortNotification PASSED [ 33%]
test_port.py::test_PortFec PASSED [ 50%]
test_port.py::test_PortPreemp PASSED [ 66%]
test_port.py::test_PortIdriver PASSED [ 83%]
test_port.py::test_PortIpredriver PASSED [100%]

====================================================== 6 passed in 43.30 seconds ======================================================

Copy link

@stevenlu99 stevenlu99 left a 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

Copy link

@stevenlu99 stevenlu99 left a 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?

@dgsudharsan
Copy link
Collaborator Author

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.
This is the general design followed in all the SAI calls and i followed the same here too.

Copy link

@stevenlu99 stevenlu99 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good

@@ -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,
Copy link
Contributor

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.

/* Set port serdes Pre-emphasis */
if (fvField(i) == "preemphasis")
{
sai_get_port_serdes_values(fvValue(i), pre_emphasis);
Copy link
Contributor

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

Copy link
Contributor

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)

@@ -22,6 +22,9 @@
#include "crmorch.h"
#include "countercheckorch.h"
#include "notifier.h"
#include "swss/json.hpp"

using json = nlohmann::json;
Copy link
Contributor

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.

@@ -1855,6 +1879,52 @@ void PortsOrch::doPortTask(Consumer &consumer)
}
}

if(pre_emphasis.size() != 0)
Copy link
Contributor

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.

orchagent/portsorch.cpp Outdated Show resolved Hide resolved
@dgsudharsan
Copy link
Collaborator Author

Ran the test after the changes.
sudo pytest -s -v --dvsname=vs test_port.py
===================================================== test session starts =====================================================
platform linux2 -- Python 2.7.15rc1, pytest-3.3.0, py-1.8.0, pluggy-0.6.0 -- /usr/bin/python
cachedir: .cache
rootdir: /home/ubuntu/preemp/sonic-swss/tests, inifile:
collected 6 items

test_port.py::TestPort::test_PortMtu PASSED [ 16%]
test_port.py::test_PortNotification PASSED [ 33%]
test_port.py::test_PortFec PASSED [ 50%]
test_port.py::test_PortPreemp PASSED [ 66%]
test_port.py::test_PortIdriver PASSED [ 83%]
test_port.py::test_PortIpredriver PASSED [100%]

================================================== 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
@lguohan
Copy link
Contributor

lguohan commented Jun 1, 2019

retest this please

2 similar comments
@lguohan
Copy link
Contributor

lguohan commented Jun 3, 2019

retest this please

@lguohan
Copy link
Contributor

lguohan commented Jun 4, 2019

retest this please

@lguohan lguohan merged commit d616764 into sonic-net:master Jun 4, 2019
@dgsudharsan dgsudharsan deleted the dgpreemp branch October 8, 2019 05:38
EdenGri pushed a commit to EdenGri/sonic-swss that referenced this pull request Feb 28, 2022
…c-net#821)

Signed-off-by: Nazarii Hnydyn <nazariig@mellanox.com>
oleksandrivantsiv pushed a commit to oleksandrivantsiv/sonic-swss that referenced this pull request Mar 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants