[openib-general] [PATCH] set lkey in mthca mpt entry

Michael S. Tsirkin mst at mellanox.co.il
Tue Mar 15 08:27:06 PST 2005


lkey does not seem to be set in the mpt entry. does this look right?

Signed-off-by: Michael S. Tsirkin <mst at mellanox.co.il>

Index: hw/mthca/mthca_mr.c
===================================================================
--- hw/mthca/mthca_mr.c	(revision 1983)
+++ hw/mthca/mthca_mr.c	(working copy)
@@ -206,9 +206,9 @@ int mthca_mr_alloc_notrans(struct mthca_
 	mpt_entry->pd        = cpu_to_be32(pd);
 	mpt_entry->start     = 0;
 	mpt_entry->length    = ~0ULL;
-
-	memset(&mpt_entry->lkey, 0,
-	       sizeof *mpt_entry - offsetof(struct mthca_mpt_entry, lkey));
+	mpt_entry->lkey      = cpu_to_be32(mr->ibmr.lkey);
+	memset(&mpt_entry->window_count, 0,
+	       sizeof *mpt_entry - offsetof(struct mthca_mpt_entry, window_count));
 
 	err = mthca_SW2HW_MPT(dev, mpt_entry,
 			      key & (dev->limits.num_mpts - 1),
@@ -327,8 +327,9 @@ int mthca_mr_alloc_phys(struct mthca_dev
 	mpt_entry->pd        = cpu_to_be32(pd);
 	mpt_entry->start     = cpu_to_be64(iova);
 	mpt_entry->length    = cpu_to_be64(total_size);
-	memset(&mpt_entry->lkey, 0,
-	       sizeof *mpt_entry - offsetof(struct mthca_mpt_entry, lkey));
+	mpt_entry->lkey      = cpu_to_be32(mr->ibmr.lkey);
+	memset(&mpt_entry->window_count, 0,
+	       sizeof *mpt_entry - offsetof(struct mthca_mpt_entry, window_count));
 	mpt_entry->mtt_seg   = cpu_to_be64(dev->mr_table.mtt_base +
 					   mr->first_seg * dev->limits.mtt_seg_size);
 

-- 
MST - Michael S. Tsirkin



More information about the general mailing list