Skip to content

Conversation

@heywji
Copy link
Contributor

@heywji heywji commented Oct 21, 2025

This patch adds a test to verify that QEMU's rx_queue_size parameter correctly influences the Windows guest's reported RxQueueSize value when RxCapacity is configured via netkvmco.exe.

ID: 2914

Signed-off-by: wji [email protected]

Summary by CodeRabbit

  • Tests
    • Added Windows-only tests validating synchronization of NIC receive queue capacity between host and guest.
    • Covers multiple RX queue/buffer variants and expected reported values across configurations.
    • Includes WMI-based verification of guest-reported queue size and a connectivity check to ensure stable network operation.

@coderabbitai
Copy link

coderabbitai bot commented Oct 21, 2025

Walkthrough

Adds a new Windows-only QEMU test configuration (qemu/tests/cfg/netkvm_rxcapacity.cfg) and a new test module (qemu/tests/netkvm_rxcapacity.py). The test sets QEMU RxCapacity, verifies the setting, invokes a Windows WMI helper to read reported RxQueueSize (parsed via regex), compares the reported value to the expected value per variant, and performs a 10-packet ping to verify connectivity. The test logs failures on mismatches, missing data, or packet loss and ensures the VM session is closed.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Areas to focus on:

  • qemu/tests/netkvm_rxcapacity.py: correctness of WMI invocation, regex used to extract RxQueueSize, error handling, and cleanup in the finally block.
  • Validation logic that compares expected vs actual RxQueueSize and the RxCapacity set/read flow.
  • Ping/connectivity checking and interpretation of results (packet-loss detection).
  • qemu/tests/cfg/netkvm_rxcapacity.cfg: variant parameters and Windows-only gating.

Pre-merge checks and finishing touches

✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: adding a test for RX queue size parameter validation in the netkvm module.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Comment @coderabbitai help to get the list of available commands and usage tips.

@heywji
Copy link
Contributor Author

heywji commented Oct 21, 2025

Test Result: PASS

 (1/3) Host_RHEL.m10.u1.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.Win2022.x86_64.io-github-autotest-qemu.netkvm_rxcapacity.rx_queue_256_rxbuf_1024.q35:  PASS (169.88 s)
 (2/3) Host_RHEL.m10.u1.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.Win2022.x86_64.io-github-autotest-qemu.netkvm_rxcapacity.rx_queue_1024_rxbuf_1024.q35: STARTED
 (2/3) Host_RHEL.m10.u1.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.Win2022.x86_64.io-github-autotest-qemu.netkvm_rxcapacity.rx_queue_1024_rxbuf_1024.q35:  PASS (170.95 s)
 (3/3) Host_RHEL.m10.u1.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.Win2022.x86_64.io-github-autotest-qemu.netkvm_rxcapacity.rx_queue_512_rxbuf_2048.q35: STARTED
 (3/3) Host_RHEL.m10.u1.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.Win2022.x86_64.io-github-autotest-qemu.netkvm_rxcapacity.rx_queue_512_rxbuf_2048.q35:  PASS (168.55 s)
RESULTS    : PASS 3 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 0

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🧹 Nitpick comments (1)
qemu/tests/netkvm_rxcapacity.py (1)

27-44: Minor: Docstring parameter description could be more precise.

Line 32 describes vm as "QEMU test object", but it should be "VM object" since it's the virtual machine instance, not the test object (which is passed separately).

Apply this diff if you'd like to improve the docstring:

-        :param vm: QEMU test object
+        :param vm: VM object
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 02fbc5f and 69d06e3.

📒 Files selected for processing (2)
  • qemu/tests/cfg/netkvm_rxcapacity.cfg (1 hunks)
  • qemu/tests/netkvm_rxcapacity.py (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
qemu/tests/netkvm_rxcapacity.py (1)
qemu/tests/ovs_host_vlan.py (1)
  • ping (53-76)
🔇 Additional comments (5)
qemu/tests/cfg/netkvm_rxcapacity.cfg (1)

10-22: LGTM: Test variants are well-structured.

The three test variants provide good coverage with different rx_queue_size and rx_capacity_value combinations.

qemu/tests/netkvm_rxcapacity.py (4)

1-5: LGTM: Imports are appropriate.

All necessary modules are imported for the test functionality.


7-25: LGTM: Well-documented test entry point.

The function signature and docstring clearly describe the test purpose and steps.


70-100: LGTM: Test setup and verification logic is sound.

The test properly initializes the VM, sets RxCapacity, retrieves RxQueueSize from WMI, and verifies the values match expectations.


114-115: LGTM: Proper cleanup in finally block.

The session is correctly closed in a finally block to ensure cleanup occurs even if the test fails.

image_snapshot = yes
driver_verifier = netkvm
wmi_cmd_url = "WIN_UTILS:\\netkvm\\WMI\\netkvm-wmi.cmd"
wmi_cmd_path = "C:\\netkvm-wmi.cmd"
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

Critical: Parameter name mismatch with Python test code.

The config file defines wmi_cmd_path, but the Python test at line 52 of netkvm_rxcapacity.py uses params.get("netkvm_wmi_path", ...). This mismatch will cause the test to always use the hardcoded default value instead of this configured path.

Apply this diff to fix the parameter name:

-    wmi_cmd_path = "C:\\netkvm-wmi.cmd"
+    netkvm_wmi_path = "C:\\netkvm-wmi.cmd"
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
wmi_cmd_path = "C:\\netkvm-wmi.cmd"
netkvm_wmi_path = "C:\\netkvm-wmi.cmd"
🤖 Prompt for AI Agents
In qemu/tests/cfg/netkvm_rxcapacity.cfg around line 8, the parameter is named
wmi_cmd_path but the Python test reads netkvm_wmi_path; rename the parameter in
this config to netkvm_wmi_path (preserving the same Windows path value) so the
test's params.get will find the configured value instead of using its hardcoded
default.

This patch adds a test to verify that QEMU's rx_queue_size parameter
correctly influences the Windows guest's reported RxQueueSize value
when RxCapacity is configured via netkvmco.exe.

Signed-off-by: wji <[email protected]>
@heywji heywji force-pushed the add_netkvm_rxcapacity2 branch from 69d06e3 to e5a5d74 Compare November 4, 2025 06:46
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
qemu/tests/netkvm_rxcapacity.py (1)

27-45: Remove unused session parameter in helper.

set_and_verify_rxcapacity never references its session argument. Please drop it (and the corresponding argument at the call site) to avoid confusion about dependencies.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 69d06e3 and e5a5d74.

📒 Files selected for processing (2)
  • qemu/tests/cfg/netkvm_rxcapacity.cfg (1 hunks)
  • qemu/tests/netkvm_rxcapacity.py (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • qemu/tests/cfg/netkvm_rxcapacity.cfg
🧰 Additional context used
🧬 Code graph analysis (1)
qemu/tests/netkvm_rxcapacity.py (1)
qemu/tests/ovs_host_vlan.py (1)
  • ping (53-76)

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