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

[port] Fix port speed set #1952

Merged

Conversation

mykolaxgerasymenko
Copy link
Contributor

Signed-off-by: Mykola Gerasymenko mykolax.gerasymenko@intel.com

What I did

Wrong port speed is set if included as a substring in a speed literal.
For example if we have a valid supported speeds for a port with 4 lanes: 40000 and 100000. Then if we try to set 4000.
sudo config interface speed Ethernet0 4000
As a result, we will get a wrong set speed 4G:

dut:~$ show interfaces status
Interface  Lanes  Speed  MTU  FEC   Alias     Vlan   Oper  Admin   Type      Asym PFC
--------- ------ ------ ----  ---- --------   -----  ----- ------ -----------   -----
Ethernet0  0,1,2,3  4G  9100  rs  Ethernet1/1 routed  up    up   QSFP28 or later     off

How I did it

Fixed finding the target (set) speed in the supported speeds list.

How to verify it

Set the wrong speed, which included as a substring in a speed literal.
For example, for a speed 40000 it is 4000.
If the wrong speed is set, an error message should appear:

admin@sonic:~$ sudo config interface speed Ethernet0 4000
Invalid speed specified: 4000
Valid speeds:40000,100000

Only speeds from the list of "Valid speeds" have been successfully set.
sudo config interface speed Ethernet0 40000

Signed-off-by: Mykola Gerasymenko <mykolax.gerasymenko@intel.com>
@mykolaxgerasymenko
Copy link
Contributor Author

@andriymoroz-mlnx @yxieca Please review.

scripts/portconfig Outdated Show resolved Hide resolved
@mykolaxgerasymenko
Copy link
Contributor Author

/azpw run

@mssonicbld
Copy link
Collaborator

/AzurePipelines run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mykolaxgerasymenko
Copy link
Contributor Author

/azp run Azure.sonic-utilities

@azure-pipelines
Copy link

Commenter does not have sufficient privileges for PR 1952 in repo Azure/sonic-utilities

@mykolaxgerasymenko
Copy link
Contributor Author

@andriymoroz-mlnx @yxieca please review.

@mykolaxgerasymenko
Copy link
Contributor Author

@jleveque @Junchao-Mellanox please review.

@mykolaxgerasymenko
Copy link
Contributor Author

@jleveque @Junchao-Mellanox Could you please review?

@yxieca yxieca merged commit 67466cb into sonic-net:master Dec 5, 2021
abdosi pushed a commit that referenced this pull request Dec 8, 2021
What I did
Wrong port speed is set if included as a substring in a speed literal.
For example if we have a valid supported speeds for a port with 4 lanes: 40000 and 100000. Then if we try to set 4000.
sudo config interface speed Ethernet0 4000
As a result, we will get a wrong set speed 4G:

dut:~$ show interfaces status
Interface  Lanes  Speed  MTU  FEC   Alias     Vlan   Oper  Admin   Type      Asym PFC
--------- ------ ------ ----  ---- --------   -----  ----- ------ -----------   -----
Ethernet0  0,1,2,3  4G  9100  rs  Ethernet1/1 routed  up    up   QSFP28 or later     off
How I did it
Fixed finding the target (set) speed in the supported speeds list.

How to verify it
Set the wrong speed, which included as a substring in a speed literal.
For example, for a speed 40000 it is 4000.
If the wrong speed is set, an error message should appear:

admin@sonic:~$ sudo config interface speed Ethernet0 4000
Invalid speed specified: 4000
Valid speeds:40000,100000
Only speeds from the list of "Valid speeds" have been successfully set.
sudo config interface speed Ethernet0 40000

Signed-off-by: Mykola Gerasymenko <mykolax.gerasymenko@intel.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants