Skip to content

refactor: simplify lspci parser and flatten device type matching logic - #187

Open
bhagathkrishnacdac wants to merge 1 commit into
omec-project:mainfrom
bhagathkrishnacdac:bess-refactor-devbind
Open

refactor: simplify lspci parser and flatten device type matching logic#187
bhagathkrishnacdac wants to merge 1 commit into
omec-project:mainfrom
bhagathkrishnacdac:bess-refactor-devbind

Conversation

@bhagathkrishnacdac

Copy link
Copy Markdown

Description
This PR refactors the device detection and classification logic (get_device_details) used in the DPDK binding utilities to improve type safety and maintainability.

Key Changes

  • Simplified Match Constraints (device_type_match): Replaced the original, arithmetic-based parameter matching routine (match_count == param_count) with a clean, fail-early logical evaluation (_matches_single_type).
  • Modularized Sub-Steps:
    • Extracted _parse_lspci_output to handle string split and format operations on device records.
    • Extracted _get_active_ssh_interfaces to safely parse active networking routes.
    • Extracted _update_module_strings to deduplicate and organize DPDK drivers and kernel modules.
  • Safe Key Access: Swapped direct dictionary indexing for fallback-safe dict.get() lookups when reading hardware interfaces and active driver modules.

Signed-off-by: bhagathkrishnacdac <bhagath.krishna@cdac.in>
@bhagathkrishnacdac
bhagathkrishnacdac requested a review from a team August 2, 2026 19:05
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.

1 participant