Skip to content

Add PCIe check commad #64

Merged
sujinmkang merged 7 commits intosonic-net:masterfrom
carycelestica:master
Jun 8, 2020
Merged

Add PCIe check commad #64
sujinmkang merged 7 commits intosonic-net:masterfrom
carycelestica:master

Conversation

@carycelestica
Copy link
Contributor

@carycelestica carycelestica commented Nov 11, 2019

What I did
Make a PCIe Diag tool for SONiC. This tool including two commands.
Commands added:
show platform pcieinfo -----> Show current device PCIe info
show platform pcieinfo -c -----> Check whether the PCIe info is correct

How I did it

  1. Add pcieutil moudle in sonic-utilities:

    Location: sonic-utilities/pcieutil/main.py
    Function: The main function will import the common API pcie_common.py and distinguish current platform

    get_platform_and_hwsku()
    Return the platform path like : /usr/share/sonic/device/$PLATFORM/plugins

  2. Add common API in pcie_common.py:

    Location: sonic_platform_base/sonic_pice/pcie_common.py
    Function: This file is used to fulfill the main interfaces including functions

    get_pcie_device()
    Getting current pcie info of the device;
    get_pcie_check()
    Compare the pcie info it got currently with pcie.yaml
    dump_conf_yaml()
    This function is used to generate pcie.yaml which used to record the original pcie info.Also you can make the pcie.yaml manually but should follow the format;

  3. The pcie.yaml file

    location: /usr/share/sonic/device/$PLATFORM/plugins/pcie.yaml
    Function:
    Used to record the original PCIe info of the device;
    Used as a criterion for judging whether the PCIe info we get is correct or not;

    how to generate this file?
    Two methods:

    1. Make it manually.But should follow the format;
    2. Use the below command to generate one.
      pcieutil pcie_generate

    The pcie.yaml is under different path due to different platforms.
    The common API will load the config file to compare with PCIe info of current device.If not found, will raise a system warning and exit

  4. How should different platform designer do if they need to use this tool.
    Just add a pcie.yaml under the config file path
    You can get a general config file and the file path by running command
    pcieutil pcie_generate
    but when you do that ,make sure the PCIe config info is correct

New command output
root@sonic:~# show platform pcieinfo
==============================Display PCIe Device===============================
......
bus:dev.fn 01:00.0 - dev_id=0xb960, Ethernet controller: Broadcom Limited Device b960
bus:dev.fn 01:00.1 - dev_id=0xb960, Ethernet controller: Broadcom Limited Device b960

root@sonic:~# show platform pcieinfo -c
===============================PCIe Device Check================================
Error: [Errno 2] No such file or directory: '/usr/share/sonic/device/x86_64-cel_seastone-r0/plugins/pcie.yaml'
Not found config file, please add a config file manually, or generate it by running [pcieutil pcie_generate]

root@sonic:~# pcieutil pcie_generate
Are you sure to overwrite config file pcie.yaml with current pcie device info? [y/N]: y
generate config file pcie.yaml under path /usr/share/sonic/device/x86_64-cel_seastone-r0/plugins

root@sonic:~# show platform pcieinfo -c
===============================PCIe Device Check================================
......
PCI Device: Ethernet controller: Broadcom Limited Device b960 ------------------ [Passed]
PCI Device: Ethernet controller: Broadcom Limited Device b960 ------------------ [Passed]
PCIe Device Checking All Test ----------->>> PASSED

root@sonic:~# show platform pcieinfo -c
===============================PCIe Device Check================================
......
PCI Device: Ethernet controller: Broadcom Limited Device b960 ------------------ [Failed]
PCI Device: Ethernet controller: Broadcom Limited Device b960 ------------------ [Passed]
PCIe Device Checking All Test ----------->>> FAILED

@msftclas
Copy link

msftclas commented Nov 11, 2019

CLA assistant check
All CLA requirements met.

Comment on lines +122 to +127






Copy link
Contributor

Choose a reason for hiding this comment

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

Please remove these trailing empty lines

sujinmkang
sujinmkang previously approved these changes Jan 24, 2020
Copy link
Contributor

@sujinmkang sujinmkang left a comment

Choose a reason for hiding this comment

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

@carycelestica can you please remove the empty line as Joe mentioned?

@sujinmkang sujinmkang dismissed their stale review January 24, 2020 19:35

after removing the empty line I will approve this change again.

@carycelestica
Copy link
Contributor Author

I have removed the empty line already

@sujinmkang
Copy link
Contributor

@carycelestica can you please rebase ?

@sujinmkang sujinmkang merged commit 3d94a59 into sonic-net:master Jun 8, 2020
oleksandrivantsiv pushed a commit to oleksandrivantsiv/sonic-platform-common that referenced this pull request Oct 25, 2024
* platform daemon (Xcvrd, Ledd) changes for multi asic platform
  * Updates in ledd daemon to use namespaces and get the namespace from selector object.
  * Updates to xcvrd daemon to use the asic_id in talking to the right DB.
  * Updated based on new sonic-py-common API's
  * Invoke initializeGlobalConfig() in the SfpUpdate/DomInfoUpdate processes as well.
Junchao-Mellanox pushed a commit to Junchao-Mellanox/sonic-platform-common that referenced this pull request May 7, 2025
… 202412 (sonic-net#64)

```<br>* c64e7e8 - (HEAD -> 202412) Merge branch '202411' of https://github.com/sonic-net/sonic-platform-common into 202412 (2025-03-12) [Sonic Automation]
* f679a67 - (origin/202411) Restore optoe page to default 0 for active cables (sonic-net#550) (2025-03-04) [mssonicbld]
* c735073 - [202411][cmis] Fix cmis.get_error_description speed for passive module (sonic-net#538) (2025-02-12) [Aryeh Feigin]
* b7e75d8 - Add 800G innolight PNs (sonic-net#540) (2025-02-07) [mssonicbld]<br>```
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.

4 participants