Skip to content

Conversation

@dragonJACson
Copy link
Contributor

@dragonJACson dragonJACson commented Sep 1, 2024

According to #13, we implement a wrapper over ibv_qp_attr_mask with bitmask_enum.

An idea is that we could provide vital and optional masks for different QP state machine transitions, so that we could check them in modify_qp easily. When users pass invalid attr / attr_mask, we could provide useful error messages indicating which mask is invalid or needed.

@dragonJACson dragonJACson requested a review from FujiZ September 1, 2024 02:14
Base automatically changed from dev/query_gid_table to main September 1, 2024 10:20
@dragonJACson dragonJACson force-pushed the dev/qp-attr branch 2 times, most recently from 1e02d8d to 9fb22ae Compare September 1, 2024 13:37
@dragonJACson
Copy link
Contributor Author

Current state:

Modify examples/test_qp.rs, the RTR to RTS part, into this

        let mut attr = QueuePairAttribute::new();
        attr.setup_state(QueuePairState::ReadyToSend)
            .setup_sq_psn(1)
            .setup_timeout(12)
            .setup_retry_cnt(7)
            .setup_rnr_retry(7)
            .setup_port(2);

compile and run, we would get

$ ./target/debug/examples/test_qp
qp pointer is QueuePair { qp: 0x564f08d23758, _phantom: PhantomData<&()> }
thread 'main' panicked at src/verbs/queue_pair.rs:296:82:
called `Result::unwrap()` on an `Err` value: "invalid masks QueuePairAttributeMask[Port], needed masks QueuePairAttributeMask[MaxReadAtomic]"
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

The invalid masks QueuePairAttributeMask[Port], needed masks QueuePairAttributeMask[MaxReadAtomic] would be much more helpful I guess?

@dragonJACson dragonJACson force-pushed the dev/qp-attr branch 2 times, most recently from 611f573 to be7abe6 Compare September 1, 2024 16:55
Just like what we did with CQ

Refs:
- #14
- #15

Signed-off-by: Luke Yue <lukedyue@gmail.com>
@dragonJACson
Copy link
Contributor Author

After refactoring, I’ve put RC qp state table into a lazy_static variable, which should be more elegant.

@dragonJACson dragonJACson force-pushed the dev/qp-attr branch 3 times, most recently from bfcfe08 to ade5ebb Compare September 16, 2024 06:44
@dragonJACson dragonJACson force-pushed the dev/qp-attr branch 9 times, most recently from 9ad23d8 to 518a14d Compare September 16, 2024 15:48
Signed-off-by: Luke Yue <lukedyue@gmail.com>
@dragonJACson dragonJACson merged commit 4a84255 into main Sep 16, 2024
@dragonJACson dragonJACson deleted the dev/qp-attr branch September 22, 2024 08:26
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.

3 participants