Skip to content

Use NETVSC_RECV/SEND_SECTION_SIZE constants instead of hardcoded values throughout ring buffer verification#4366

Merged
LiliDeng merged 3 commits intobugfix/ringbuffer-tolerance-64k-page_190326_133123from
copilot/sub-pr-4364
Mar 20, 2026
Merged

Use NETVSC_RECV/SEND_SECTION_SIZE constants instead of hardcoded values throughout ring buffer verification#4366
LiliDeng merged 3 commits intobugfix/ringbuffer-tolerance-64k-page_190326_133123from
copilot/sub-pr-4364

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 20, 2026

All ring buffer calculations in verify_ring_buffer_settings used hardcoded 1728/6144 even after NETVSC_RECV_SECTION_SIZE/NETVSC_SEND_SECTION_SIZE constants were introduced, creating drift risk between tolerance computation and buffer size math.

Changes

  • Replace all remaining 1728NETVSC_RECV_SECTION_SIZE and 6144NETVSC_SEND_SECTION_SIZE in:
    • original_rxbuffer / original_txbuffer (sections → MB conversion)
    • expected_rx / expected_tx (MB → sections conversion)
# Before
original_rxbuffer = round((original_rx * 1728) / (1024 * 1024))
original_txbuffer = round((original_tx * 6144) / (1024 * 1024))
expected_rx = int((rxbuffer * 1024 * 1024) / 1728)
expected_tx = int((txbuffer * 1024 * 1024) / 6144)

# After
original_rxbuffer = round((original_rx * NETVSC_RECV_SECTION_SIZE) / (1024 * 1024))
original_txbuffer = round((original_tx * NETVSC_SEND_SECTION_SIZE) / (1024 * 1024))
expected_rx = int((rxbuffer * 1024 * 1024) / NETVSC_RECV_SECTION_SIZE)
expected_tx = int((txbuffer * 1024 * 1024) / NETVSC_SEND_SECTION_SIZE)

💬 Send tasks to Copilot coding agent from Slack and Teams to turn conversations into code. Copilot posts an update in your thread when it's finished.

…nts throughout

Co-authored-by: LiliDeng <10083705+LiliDeng@users.noreply.github.com>
Copilot AI changed the title [WIP] [WIP] Address feedback on using NETVSC section sizes instead of hardcoded values Use NETVSC_RECV/SEND_SECTION_SIZE constants instead of hardcoded values throughout ring buffer verification Mar 20, 2026
Copilot AI requested a review from LiliDeng March 20, 2026 02:08
@LiliDeng
Copy link
Copy Markdown
Collaborator

@copilot please fix the CI error

nox > flake8 
./lisa/microsoft/testsuites/network/networksettings.py:118:10: N806 variable 'NETVSC_RECV_SECTION_SIZE' in function should be lowercase
./lisa/microsoft/testsuites/network/networksettings.py:119:10: N806 variable 'NETVSC_SEND_SECTION_SIZE' in function should be lowercase
./lisa/microsoft/testsuites/network/networksettings.py:175:26: BLK100 Black would make changes.

…formatting (BLK100)

Co-authored-by: LiliDeng <10083705+LiliDeng@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Mar 20, 2026

@copilot please fix the CI error

...

Fixed in d65f993:

  • N806: Moved NETVSC_RECV_SECTION_SIZE and NETVSC_SEND_SECTION_SIZE to module level (uppercase is only valid for module-level constants per PEP 8)
  • BLK100: Collapsed .is_between(...) calls to single lines per Black formatting

@LiliDeng LiliDeng marked this pull request as ready for review March 20, 2026 03:31
@LiliDeng LiliDeng merged commit a777f53 into bugfix/ringbuffer-tolerance-64k-page_190326_133123 Mar 20, 2026
27 checks passed
@LiliDeng LiliDeng deleted the copilot/sub-pr-4364 branch March 20, 2026 13:57
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.

2 participants