]> git.openfabrics.org - ~shefty/rdma-win.git/commitdiff
[MTHCA] 1. bugfix in register_mr verb: there was a lack of memory securing (needed...
authorleonidk <leonidk@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Tue, 16 May 2006 15:38:55 +0000 (15:38 +0000)
committerleonidk <leonidk@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Tue, 16 May 2006 15:38:55 +0000 (15:38 +0000)
2. bugfix: mthca_tavor_post_receive() puts the number of WRs (int nreq) in 8-bit field. In case, when nreq=256*k, it will cause corruption of qp number in the doorbell;
3. cosmetics

git-svn-id: svn://openib.tc.cornell.edu/gen1@354 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86

trunk/hw/mthca/kernel/mthca_mad.c
trunk/hw/mthca/kernel/mthca_provider.c
trunk/hw/mthca/kernel/mthca_provider.h
trunk/hw/mthca/kernel/mthca_qp.c
trunk/hw/mthca/user/mlnx_uvp_qp.c

index b4fec626a54e6345750ea1fd30268996038fe3be..f078a85e11a7711985c48882de8436ec6ef5dfbd 100644 (file)
@@ -191,7 +191,7 @@ int mthca_process_mad(struct ib_device *ibdev,
        u8 status;
        u16 slid = in_wc ? in_wc->recv.ud.remote_lid : cl_ntoh16(IB_LID_PERMISSIVE);
 
-       HCA_PRINT( TRACE_LEVEL_VERBOSE ,HCA_DBG_MAD ,("mthca_process_mad: \n\tin: Class %02x, Method %02x, AttrId %x, AttrMod %x, ClSpec %x, Tid %I64x\n",
+       HCA_PRINT( TRACE_LEVEL_VERBOSE ,HCA_DBG_MAD ,("mthca_process_mad: in: Class %02x, Method %02x, AttrId %x, AttrMod %x, ClSpec %x, Tid %I64x\n",
                (u32)in_mad->mad_hdr.mgmt_class, (u32)in_mad->mad_hdr.method, 
                (u32)in_mad->mad_hdr.attr_id, in_mad->mad_hdr.attr_mod, 
                (u32)in_mad->mad_hdr.class_specific, in_mad->mad_hdr.tid ));
@@ -268,7 +268,7 @@ int mthca_process_mad(struct ib_device *ibdev,
        if (!out_mad->mad_hdr.status)
                smp_snoop(ibdev, port_num, in_mad);
 
-       HCA_PRINT( TRACE_LEVEL_VERBOSE ,HCA_DBG_MAD,("mthca_process_mad: \n\tout: Class %02x, Method %02x, AttrId %x, AttrMod %x, ClSpec %x, Tid %I64x, Status %x\n",
+       HCA_PRINT( TRACE_LEVEL_VERBOSE ,HCA_DBG_MAD,("mthca_process_mad: out: Class %02x, Method %02x, AttrId %x, AttrMod %x, ClSpec %x, Tid %I64x, Status %x\n",
                (u32)in_mad->mad_hdr.mgmt_class, (u32)in_mad->mad_hdr.method, 
                (u32)in_mad->mad_hdr.attr_id, in_mad->mad_hdr.attr_mod, 
                (u32)in_mad->mad_hdr.class_specific, in_mad->mad_hdr.tid,
index 52b65cd4683f0188fc0053d685b578eba22c32cc..f2ad6b2b30a619f30d9de97984c1c04a2209a46b 100644 (file)
@@ -1080,10 +1080,31 @@ struct ib_mr *mthca_reg_user_mr(struct ib_pd *pd,
        if (err)
                goto err_mt_alloc;
 
+       // secure memory
+       if (!pd->ucontext)
+               goto done;
+       __try {
+               mr->secure_handle = MmSecureVirtualMemory ( vaddr, (SIZE_T)length,
+                       (acc & ~MTHCA_ACCESS_REMOTE_READ) ? PAGE_READWRITE : PAGE_READONLY );
+               if (mr->secure_handle == NULL) {
+                       err = -EFAULT;
+                       goto err_secure;
+               }
+       }
+       __except (EXCEPTION_EXECUTE_HANDLER) {
+               NTSTATUS Status = GetExceptionCode();
+               HCA_PRINT(TRACE_LEVEL_ERROR ,HCA_DBG_MEMORY ,
+                       ("Exception 0x%x on MmSecureVirtualMemory(), addr %p, size %I64d, access %#x\n", 
+                       Status, vaddr, length, acc ));
+               err = -EFAULT;
+               goto err_secure;
+       }
+done:  
        free_page((void*) pages);
        HCA_EXIT(HCA_DBG_MEMORY);
        return &mr->ibmr;
 
+err_secure:
 err_mt_alloc:
 err_write_mtt:
        free_page((void*) pages);
@@ -1102,8 +1123,10 @@ int mthca_dereg_mr(struct ib_mr *mr)
 {
        struct mthca_mr *mmr = to_mmr(mr);
        mthca_free_mr(to_mdev(mr->device), mmr);
-       if (mr->pd->ucontext)
+       if (mr->pd->ucontext) {
                ibv_umem_release(mr->pd->device, &mmr->umem);
+               MmUnsecureVirtualMemory ( mmr->secure_handle );
+       }
        kfree(mmr);
        return 0;
 }
index c5a457b7f902ba063687593933991a77d420d6d3..bc1523fc23f9108648abec20010e8f3a36d438f1 100644 (file)
@@ -76,11 +76,9 @@ struct mthca_mr {
        //NB: the start of this structure is to be equal to mlnx_mro_t !
        //NB: the structure was not inserted here for not to mix driver and provider structures
        struct ib_mr      ibmr;
-#ifdef WIN_TO_BE_REMOVED
-       mt_iobuf_t              iobuf;
-#endif
        struct mthca_mtt *mtt;
        struct ib_umem umem;
+       void *secure_handle;
 };
 
 struct mthca_fmr {
index 5ca10094b2dfb5d1d09c16739ae4f0ee68dec285..30d34a1228f7e66a9ef4cc144fd5866352d112dd 100644 (file)
@@ -1820,7 +1820,7 @@ int mthca_tavor_post_receive(struct ib_qp *ibqp, struct _ib_recv_wr *wr,
 out:
        if (likely(nreq)) {
                doorbell[0] = cl_hton32((qp->rq.next_ind << qp->rq.wqe_shift) | size0);
-               doorbell[1] = cl_hton32((qp->qpn << 8) | nreq);
+               doorbell[1] = cl_hton32((qp->qpn << 8) | (nreq & 255));
 
                wmb();
 
index 683d83cd172c0f488c856af8dab7ae75172aac4c..a7e0d39e01bc024014d32f7dc42e265f2d649ca7 100644 (file)
@@ -491,7 +491,7 @@ int mthca_tavor_post_recv(struct ibv_qp *ibqp, struct _ib_recv_wr *wr,
 out:
        if (likely(nreq)) {
                doorbell[0] = cl_hton32((qp->rq.next_ind << qp->rq.wqe_shift) | size0);
-               doorbell[1] = cl_hton32((ibqp->qp_num << 8) | nreq);
+               doorbell[1] = cl_hton32((ibqp->qp_num << 8) | (nreq & 255));
 
                /*
                 * Make sure that descriptors are written before