Skip to content

[portsorch]: Rewrite validatePortSpeed() method. Use true lazy approach#506

Merged
pavel-shirshov merged 4 commits intosonic-net:masterfrom
pavel-shirshov:pavelsh/fix_speed
May 17, 2018
Merged

[portsorch]: Rewrite validatePortSpeed() method. Use true lazy approach#506
pavel-shirshov merged 4 commits intosonic-net:masterfrom
pavel-shirshov:pavelsh/fix_speed

Conversation

@pavel-shirshov
Copy link
Copy Markdown
Contributor

@pavel-shirshov pavel-shirshov commented May 16, 2018

What I did
I've overwritten validatePortSpeed() method of PortsOrch class. Also I've rename it to more suitable isSpeedSupported.
Previously:

  1. The method tried to get the speed list many times if this operation is not supported by platform
  2. The method use two get operations to get the list, currently it should be one in the most cases.
  3. The method returns false if:
    1. internally it gets any error except NOT_SUPPORTED and NOT_IMPLEMENTED
    2. the speed is not found in the list of speeds.
      Now:
  4. the number of SAI GET operations are minimized.
  5. the function return false only if we get a list of speeds and the requested speed not in the list of successfully returned supported speeds. Otherwise it's always true.

Why I did it
Because this method slowed fast-reboot operations down (multiple get operations).
Also this method gave a noise with false ERRORs in the syslog.

How I verified it
Build and run on my DUT

Details if related

…true for erross also. Even we receive an error, we could move further. It's not critical

}

PortSupportedSpeeds &supp_speeds = m_portSupportedSpeeds[port_id];
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

m_portSupportedSpeeds [](start = 39, length = 21)

we need to remove the port_id from m_portSupprtedSpeeds when the port is removed. but this is seems like a bug exist already.

Copy link
Copy Markdown
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.

:shipit:

@pavel-shirshov pavel-shirshov merged commit 8d810be into sonic-net:master May 17, 2018
@pavel-shirshov pavel-shirshov deleted the pavelsh/fix_speed branch May 17, 2018 18:26
oleksandrivantsiv pushed a commit to oleksandrivantsiv/sonic-swss that referenced this pull request Mar 1, 2023
Janetxxx pushed a commit to Janetxxx/sonic-swss that referenced this pull request Nov 10, 2025
…ch (sonic-net#506)

* We have enough logging inside of the method. Remove the excessive one

* Rewrite portsorch::validatespeed. Use true lazy approach to minimize SAI get operations on each port

* Restore the missed attr.id

* Rename validatePortSpeed to isSpeedSupported. Change logic to return true for erross also. Even we receive an error, we could move further. It's not critical
jianyuewu pushed a commit to jianyuewu/sonic-swss that referenced this pull request Dec 24, 2025
…name. (sonic-net#506)

**Why I did it**
The getLinkByName may fail because of the outdated netlink cache

**How I did it**
Refill the netlink cache when we fail to get link object.
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.

2 participants