pub fn bring_to_rtr(&self, cm: *mut ib_cm_id) -> KernelResult<()> {
        // we should first check qp status
        self.bring_to_init(cm)?;

        if self.get_status().unwrap() == ib_qp_state::IB_QPS_INIT {
            let mut attr: ib_qp_attr = Default::default();
            let mut mask: linux_kernel_module::c_types::c_int = ib_qp_attr_mask::IB_QP_STATE;
            attr.qp_state = ib_qp_state::IB_QPS_RTR;

            let ret = unsafe { ib_cm_init_qp_attr(cm, to_ptr!(attr), to_ptr!(mask)) };
            if ret != 0 {
                println!("cm init qp attr error!");
                return Err(Error::from_kernel_errno(ret));
            }

            attr.rq_psn = self.get_qp_num();
            attr.max_dest_rd_atomic = crate::consts::MAX_RD_ATOMIC as u8;
            mask |= ib_qp_attr_mask::IB_QP_RQ_PSN | ib_qp_attr_mask::IB_QP_MAX_DEST_RD_ATOMIC;

            let ret = unsafe { ib_modify_qp(self.get_qp(), to_ptr!(attr), mask) };
            if ret != 0 {
                println!("bring init to recv error!");
                return Err(Error::from_kernel_errno(ret));
            }
        } else {}
        Ok(())
    }
// bring QP from init -> ready to receive
bring QP from init -> ready to receive
bring QP from init - > ready to receive
pub fn bring_to_rtr(&self, cm: *mut ib_cm_id) -> KernelResult<()> {
        // we should first check qp status
        self.bring_to_init(cm)?;
        if self.get_status().unwrap() == ib_qp_state::IB_QPS_INIT {
            let mut attr: ib_qp_attr = Default::default();
            let mut mask: linux_kernel_module::c_types::c_int = ib_qp_attr_mask::IB_QP_STATE;
            attr.qp_state = ib_qp_state::IB_QPS_RTR;
            let ret = unsafe { ib_cm_init_qp_attr(cm, to_ptr!(attr), to_ptr!(mask)) };
            if ret != 0 {
                println!("cm init qp attr error!");
                return Err(Error::from_kernel_errno(ret));
            }
            attr.rq_psn = self.get_qp_num();
            attr.max_dest_rd_atomic = crate::consts::MAX_RD_ATOMIC as u8;
            mask |= ib_qp_attr_mask::IB_QP_RQ_PSN | ib_qp_attr_mask::IB_QP_MAX_DEST_RD_ATOMIC;
            let ret = unsafe { ib_modify_qp(self.get_qp(), to_ptr!(attr), mask) };
            if ret != 0 {
                println!("bring init to recv error!");
                return Err(Error::from_kernel_errno(ret));
            }
        } else {}
        Ok(())
    }
pub fn bring_to_rtr ( & self , cm : * mut ib_cm_id ) -> KernelResult < ( ) > { // we should first check qp status self . bring_to_init ( cm ) ? ; if self . get_status ( ) . unwrap ( ) == ib_qp_state :: IB_QPS_INIT { let mut attr : ib_qp_attr = Default :: default ( ) ; let mut mask : linux_kernel_module :: c_types :: c_int = ib_qp_attr_mask :: IB_QP_STATE ; attr . qp_state = ib_qp_state :: IB_QPS_RTR ; let ret = unsafe { ib_cm_init_qp_attr ( cm , to_ptr ! ( attr ) , to_ptr ! ( mask ) ) } ; if ret != 0 { println ! ( " " ) ; return Err ( Error :: from_kernel_errno ( ret ) ) ; } attr . rq_psn = self . get_qp_num ( ) ; attr . max_dest_rd_atomic = crate :: consts :: MAX_RD_ATOMIC as u8 ; mask |= ib_qp_attr_mask :: IB_QP_RQ_PSN | ib_qp_attr_mask :: IB_QP_MAX_DEST_RD_ATOMIC ; let ret = unsafe { ib_modify_qp ( self . get_qp ( ) , to_ptr ! ( attr ) , mask ) } ; if ret != 0 { println ! ( " " ) ; return Err ( Error :: from_kernel_errno ( ret ) ) ; } } else { } Ok ( ( ) ) }
bring QP from init -> ready to receive
bring QP from init - > ready to receive
&self
cm
*mut ib_cm_id