Skip to content

Add to check pcie configuration revision to get the right configuration. #195

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

Merged
merged 1 commit into from
Jun 14, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions sonic_platform_base/sonic_pcie/pcie_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,12 @@ class PcieUtil(PcieBase):
# got the config file path
def __init__(self, path):
self.config_path = path
self._conf_rev = None

# load the config file
def load_config_file(self):
config_file = self.config_path + "/" + "pcie.yaml"
conf_rev = "_{}".format(self._conf_rev) if self._conf_rev else ""
config_file = "{}/pcie{}.yaml".format(self.config_path, conf_rev)
try:
with open(config_file) as conf_file:
self.confInfo = yaml.load(conf_file)
Expand Down Expand Up @@ -137,6 +139,8 @@ def get_pcie_aer_stats(self, domain=0, bus=0, device=0, func=0):
# generate the config file with current pci device
def dump_conf_yaml(self):
curInfo = self.get_pcie_device()
with open(self.config_path + "/" + "pcie.yaml", "w") as conf_file:
conf_rev = "_{}".format(self._conf_rev) if self._conf_rev else ""
config_file = "{}/pcie{}.yaml".format(self.config_path, conf_rev)
with open(config_file, "w") as conf_file:
yaml.dump(curInfo, conf_file, default_flow_style=False)
return