Closed dragonJACson closed 1 month ago
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?
After refactoring, I’ve put RC qp state table into a lazy_static
variable, which should be more elegant.
According to #13, we implement a wrapper over
ibv_qp_attr_mask
withbitmask_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 invalidattr
/attr_mask
, we could provide useful error messages indicating whichmask
is invalid or needed.