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

Fix issue: enhancing PDDF common eeprom APIs to use caching (#13835) #13848

Merged
merged 1 commit into from
Mar 15, 2023

Conversation

FuzailBrcm
Copy link
Contributor

@FuzailBrcm FuzailBrcm commented Feb 17, 2023

Why I did it

To enhance pddf_eeprom.py to use caching and fix #13835

How I did it

  • Utilising the in-built caching mechanism in the base class eeprom_base.py.
  • Adding a cache file to store the eeprom data.

How to verify it

By running 'decode-syseeprom' or 'show platform syseeprom' commands.

root@sonic:/home/admin#
root@sonic:/home/admin#
root@sonic:/home/admin# decode-syseeprom
TlvInfo Header:
   Id String:    TlvInfo
   Version:      1
   Total Length: 168
TLV Name             Code Len Value
-------------------- ---- --- -----
Manufacture Date     0x25  19 02/21/2019 02:52:19
Label Revision       0x27   4 R01A
Platform Name        0x28  27 x86_64-accton_as7816_64x-r0
ONIE Version         0x29  13 2018.05.00.08
Manufacturer         0x2B   6 Accton
Manufacture Country  0x2C   2 TW
Vendor Name          0x2D   8 Edgecore
Diag Version         0x2E   7 0.0.0.3
Product Name         0x21  18 7816-64X-O-AC-F-JN
Part Number          0x22  13 FP3AT7664000A
Serial Number        0x23  11 AAA1903AAEV
Base MAC Address     0x24   6 B8:6A:97:FD:C6:6E
MAC Addresses        0x2A   2 300
CRC-32               0xFE   4 0xAD3A2114
root@sonic:/home/admin# ls -l /var/cache/sonic/decode-syseeprom/
total 4
-rw-r--r-- 1 root root 179 Feb 16 18:32 syseeprom_cache
root@sonic:/home/admin# rm /var/cache/sonic/decode-syseeprom/*
root@sonic:/home/admin# decode-syseeprom
TlvInfo Header:
   Id String:    TlvInfo
   Version:      1
   Total Length: 168
TLV Name             Code Len Value
-------------------- ---- --- -----
Manufacture Date     0x25  19 02/21/2019 02:52:19
Label Revision       0x27   4 R01A
Platform Name        0x28  27 x86_64-accton_as7816_64x-r0
ONIE Version         0x29  13 2018.05.00.08
Manufacturer         0x2B   6 Accton
Manufacture Country  0x2C   2 TW
Vendor Name          0x2D   8 Edgecore
Diag Version         0x2E   7 0.0.0.3
Product Name         0x21  18 7816-64X-O-AC-F-JN
Part Number          0x22  13 FP3AT7664000A
Serial Number        0x23  11 AAA1903AAEV
Base MAC Address     0x24   6 B8:6A:97:FD:C6:6E
MAC Addresses        0x2A   2 300
CRC-32               0xFE   4 0xAD3A2114
root@sonic:/home/admin# ls -l /var/cache/sonic/decode-syseeprom/
total 4
-rw-r--r-- 1 root root 179 Feb 16 18:39 syseeprom_cache
root@sonic:/home/admin# show platform syseeprom
TlvInfo Header:
   Id String:    TlvInfo
   Version:      1
   Total Length: 168
TLV Name             Code      Len  Value
-------------------  ------  -----  ---------------------------
Product Name         0x21       18  7816-64X-O-AC-F-JN
Part Number          0x22       13  FP3AT7664000A
Serial Number        0x23       11  AAA1903AAEV
Base MAC Address     0x24        6  B8:6A:97:FD:C6:6E
Manufacture Date     0x25       19  02/21/2019 02:52:19
Label Revision       0x27        4  R01A
Platform Name        0x28       27  x86_64-accton_as7816_64x-r0
ONIE Version         0x29       13  2018.05.00.08
MAC Addresses        0x2A        2  300
Manufacturer         0x2B        6  Accton
Manufacture Country  0x2C        2  TW
Vendor Name          0x2D        8  Edgecore
Diag Version         0x2E        7  0.0.0.3
CRC-32               0xFE        4  0xAD3A2114

(checksum valid)
root@sonic:/home/admin#
root@sonic:/home/admin#
root@sonic:/home/admin# show log eeprom
Feb 16 18:01:08.362048 sonic INFO pmon#supervisord 2023-02-16 18:01:08,359 INFO spawned: 'syseepromd' with pid 28
Feb 16 18:01:19.292994 sonic INFO pmon#supervisord 2023-02-16 18:01:19,291 INFO success: syseepromd entered RUNNING state, process has stayed up for > than 10 seconds (startsecs)
Feb 16 18:32:16.093927 sonic INFO pre_pddf_init.sh[330]: PSU-1 eeprom use parent_bus:0x9, dev_addr:0x50
Feb 16 18:32:16.093941 sonic INFO pre_pddf_init.sh[330]: PSU-2 eeprom use parent_bus:0xa, dev_addr:0x53
Feb 16 18:32:16.095145 sonic INFO audisp-tacplus: Audisp-tacplus: Token: (/usr/local/bin/decode-syseeprom#015)
Feb 16 18:32:20.832207 sonic INFO kernel: [   10.371169] psu 9-0050: hwmon3: psu 'psu_eeprom'
Feb 16 18:32:20.896237 sonic INFO kernel: [   10.436874] psu 10-0053: hwmon5: psu 'psu_eeprom'
Feb 16 18:34:19.927945 sonic INFO pmon#supervisord 2023-02-16 18:34:19,927 INFO spawned: 'syseepromd' with pid 29
Feb 16 18:34:30.804083 sonic INFO pmon#supervisord 2023-02-16 18:34:30,802 INFO success: syseepromd entered RUNNING state, process has stayed up for > than 10 seconds (startsecs)
root@sonic:/home/admin#

Which release branch to backport (provide reason below if selected)

  • 201811
  • 201911
  • 202006
  • 202012
  • 202106
  • 202111
  • 202205
  • 202211

Description for the changelog

Ensure to add label/tag for the feature raised. example - PR#2174 under sonic-utilities repo. where, Generic Config and Update feature has been labelled as GCU.

Link to config_db schema for YANG module changes

A picture of a cute animal (not mandatory but encouraged)

@FuzailBrcm FuzailBrcm requested a review from lguohan as a code owner February 17, 2023 06:35
@FuzailBrcm
Copy link
Contributor Author

@jostar-yang
Please help review

Copy link
Contributor

@jostar-yang jostar-yang left a comment

Choose a reason for hiding this comment

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

It is fine to me.

@FuzailBrcm
Copy link
Contributor Author

@prgeor
Please review the changes and merge

@prgeor prgeor added the PDDF label Mar 14, 2023
@yxieca yxieca merged commit d3e3565 into sonic-net:master Mar 15, 2023
qnos pushed a commit to qnos/sonic-buildimage that referenced this pull request Nov 12, 2023
…t#13835) (sonic-net#13848)

Why I did it
To enhance pddf_eeprom.py to use caching and fix sonic-net#13835

How I did it
Utilising the in-built caching mechanism in the base class eeprom_base.py.
Adding a cache file to store the eeprom data.

How to verify it
By running 'decode-syseeprom' or 'show platform syseeprom' commands.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[PDDF] Enhance pddf_eeprom to use cache
4 participants