pub fn bring_to_init(&self, cm: *mut ib_cm_id) -> KernelResult<()> {
        // we should first check qp status
        if self.get_status().unwrap() == ib_qp_state::IB_QPS_RESET || self.get_status().unwrap() == ib_qp_state::IB_QPS_ERR {
            // println!("real bring to init with cm {:?}", self.cm);
            // bring if only in a reset state
            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_INIT;

            let ret = unsafe { ib_cm_init_qp_attr(cm, to_ptr!(attr), to_ptr!(mask)) };
            if ret != 0 {
                println!("[bring_to_init] cm init qp attr error!");
                return Err(Error::from_kernel_errno(ret));
            }
            let access_flags = 0
                | ib_access_flags::IB_ACCESS_LOCAL_WRITE
                | ib_access_flags::IB_ACCESS_REMOTE_ATOMIC
                | ib_access_flags::IB_ACCESS_REMOTE_READ
                | ib_access_flags::IB_ACCESS_REMOTE_WRITE;
            attr.qp_access_flags |= access_flags as i32;

            mask |= ib_qp_attr_mask::IB_QP_ACCESS_FLAGS;
            let ret = unsafe { ib_modify_qp(self.get_qp(), to_ptr!(attr), mask) };
            if ret != 0 {
                println!("[bring_to_init] bring reset to init error!");
                return Err(Error::from_kernel_errno(ret));
            }
        }
        Ok(())
    }
// bring QP from reset -> init
bring QP from reset -> init
bring QP from reset - > init
pub fn bring_to_init(&self, cm: *mut ib_cm_id) -> KernelResult<()> {
        // we should first check qp status
        if self.get_status().unwrap() == ib_qp_state::IB_QPS_RESET || self.get_status().unwrap() == ib_qp_state::IB_QPS_ERR {
            // println!("real bring to init with cm {:?}", self.cm);
            // bring if only in a reset state
            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_INIT;
            let ret = unsafe { ib_cm_init_qp_attr(cm, to_ptr!(attr), to_ptr!(mask)) };
            if ret != 0 {
                println!("[bring_to_init] cm init qp attr error!");
                return Err(Error::from_kernel_errno(ret));
            }
            let access_flags = 0
                | ib_access_flags::IB_ACCESS_LOCAL_WRITE
                | ib_access_flags::IB_ACCESS_REMOTE_ATOMIC
                | ib_access_flags::IB_ACCESS_REMOTE_READ
                | ib_access_flags::IB_ACCESS_REMOTE_WRITE;
            attr.qp_access_flags |= access_flags as i32;
            mask |= ib_qp_attr_mask::IB_QP_ACCESS_FLAGS;
            let ret = unsafe { ib_modify_qp(self.get_qp(), to_ptr!(attr), mask) };
            if ret != 0 {
                println!("[bring_to_init] bring reset to init error!");
                return Err(Error::from_kernel_errno(ret));
            }
        }
        Ok(())
    }
pub fn bring_to_init ( & self , cm : * mut ib_cm_id ) -> KernelResult < ( ) > { // we should first check qp status if self . get_status ( ) . unwrap ( ) == ib_qp_state :: IB_QPS_RESET || self . get_status ( ) . unwrap ( ) == ib_qp_state :: IB_QPS_ERR { // println!("real bring to init with cm {:?}", self.cm); // bring if only in a reset state 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_INIT ; 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 ) ) ; } let access_flags = 0 | ib_access_flags :: IB_ACCESS_LOCAL_WRITE | ib_access_flags :: IB_ACCESS_REMOTE_ATOMIC | ib_access_flags :: IB_ACCESS_REMOTE_READ | ib_access_flags :: IB_ACCESS_REMOTE_WRITE ; attr . qp_access_flags |= access_flags as i32 ; mask |= ib_qp_attr_mask :: IB_QP_ACCESS_FLAGS ; let ret = unsafe { ib_modify_qp ( self . get_qp ( ) , to_ptr ! ( attr ) , mask ) } ; if ret != 0 { println ! ( " " ) ; return Err ( Error :: from_kernel_errno ( ret ) ) ; } } Ok ( ( ) ) }
bring QP from reset -> init
bring QP from reset - > init
&self
cm
*mut ib_cm_id