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 parsing of PCI domains longer than 4 digits #373

Merged
merged 2 commits into from
Sep 5, 2024

Conversation

ianb-mp
Copy link
Contributor

@ianb-mp ianb-mp commented Sep 4, 2024

Allow parsing of PCI addresses like 10001:80:05.0 where the domain component is longer than 4 digits.

The domain component should be able to handle values up to 32 bits - see: https://patches.dpdk.org/project/dpdk/patch/20200512133057.106374-1-dariusz.stojaczyk@intel.com/

Fixes #372

Signed-off-by: Ian Bishop <151477169+ianb-mp@users.noreply.github.com>
@@ -13,7 +13,7 @@ import (

var (
regexAddress *regexp.Regexp = regexp.MustCompile(
`^(([0-9a-f]{0,4}):)?([0-9a-f]{2}):([0-9a-f]{2})\.([0-9a-f]{1})$`,
`^(([0-9a-f]{0,8}):)?([0-9a-f]{2}):([0-9a-f]{2})\.([0-9a-f]{1})$`,
Copy link
Owner

Choose a reason for hiding this comment

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

@ianb-mp OK, so to be fully compliant with the PCI-X spec, I believe this needs to be:

^(1?)(([0-9a-f]{0,4}):)?([0-9a-f]{2}):([0-9a-f]{2})\.([0-9a-f]{1})$

Because, according to my research, the domain part of the PCI address is 4 hexadigits OR a 1 followed by 4 hexadigits (for the cases where the PCI extension configuration space is used)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok, I've pushed another commit with that change however moved the 1? inside the existing capture group. I also added a test.

@ianb-mp ianb-mp force-pushed the fix_parse branch 3 times, most recently from ccca41a to e38d615 Compare September 4, 2024 23:28
Signed-off-by: Ian Bishop <151477169+ianb-mp@users.noreply.github.com>
Copy link
Owner

@jaypipes jaypipes left a comment

Choose a reason for hiding this comment

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

Awesome, thank you @ianb-mp !

@jaypipes jaypipes merged commit 3be9025 into jaypipes:main Sep 5, 2024
8 of 12 checks passed
ianb-mp added a commit to ianb-mp/sriov-network-operator that referenced this pull request Sep 5, 2024
See: jaypipes/ghw#373

Signed-off-by: Ian Bishop <151477169+ianb-mp@users.noreply.github.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.

error parsing pci address
2 participants