Skip to content

Conversation

@dragonJACson
Copy link
Contributor

Add QueuePairStateTableEntry validation for UD, UD, RawPacket QP types, matching the kernel's qp_state_table.

@gemini-code-assist
Copy link

Summary of Changes

Hello @dragonJACson, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the robustness of Queue Pair state management by introducing type-specific validation rules for Unreliable Connection, Unreliable Datagram, and Raw Packet Queue Pairs. By mirroring the kernel's qp_state_table behavior, the system now accurately enforces valid state transitions and required attributes for each QP type, preventing erroneous configurations and improving overall stability.

Highlights

  • Type-Specific QP State Tables: Introduced dedicated state transition tables for Unreliable Connection (UC), Unreliable Datagram (UD), and Raw Packet Queue Pair types, mirroring kernel behavior for accurate validation.
  • Dynamic State Table Selection: Implemented a mechanism to dynamically select the appropriate state transition table based on the Queue Pair's specific type, ensuring correct validation rules are applied.
  • Enhanced State Transition Validation: Modified the core attr_mask_check function to incorporate the Queue Pair type, enabling it to perform type-aware validation of state transitions and required attributes.
  • Comprehensive Unit Testing: Added extensive unit tests covering valid and invalid state transitions, as well as correct and incorrect attribute mask usage for all supported Queue Pair types (RC, UC, UD, Raw Packet).
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@codecov
Copy link

codecov bot commented Jan 10, 2026

Codecov Report

❌ Patch coverage is 97.23502% with 12 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/ibverbs/queue_pair.rs 97.23% 12 Missing ⚠️
Files with missing lines Coverage Δ
src/ibverbs/queue_pair.rs 88.36% <97.23%> (+17.76%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request adds support for validating Queue Pair state transitions for UC, UD, and Raw Packet QP types by introducing new state tables, which is a great enhancement for correctness. However, a medium-severity Denial of Service vulnerability was identified: the conversion of numeric QP types to their enum representation can panic if an unknown value is received from the kernel driver, potentially crashing the application thread. Further improvements could include reducing code duplication in state table initializations and improving test coverage.

Add QueuePairStateTableEntry validation for UD, UD, RawPacket QP types,
matching the kernel's qp_state_table.

Signed-off-by: Luke Yue <lukedyue@gmail.com>
@dragonJACson dragonJACson force-pushed the dev/uc-ud-modify-check branch from 161d37f to 4dd77af Compare January 10, 2026 04:37
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