[ofa-general] [PATCH 1/4] RDMA/nes: Fix 4K PBL accounting

Chien Tung ctung at neteffect.com
Thu Oct 2 07:39:30 PDT 2008


From: Vishal Thanki <vishal.thanki at einfochips.com>

Properly account for freed 4K PBL.

Signed-off-by: Vishal Thanki <vishal.thanki at einfochips.com>
Signed-off-by: Sweta Bhatt <sweta.bhatt at einfochips.com>
Signed-off-by: Chien Tung <ctung at neteffect.com>
--
Roland,

Please consider these 4 patches for 2.6.28.

 drivers/infiniband/hw/nes/nes_verbs.c |   19 ++++++++++++-------
 1 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/drivers/infiniband/hw/nes/nes_verbs.c b/drivers/infiniband/hw/nes/nes_verbs.c
index 932e56f..cd09493 100644
--- a/drivers/infiniband/hw/nes/nes_verbs.c
+++ b/drivers/infiniband/hw/nes/nes_verbs.c
@@ -538,14 +538,9 @@ static int nes_dealloc_fmr(struct ib_fmr *ibfmr)
 	struct nes_fmr *nesfmr = to_nesfmr(nesmr);
 	struct nes_vnic *nesvnic = to_nesvnic(ibfmr->device);
 	struct nes_device *nesdev = nesvnic->nesdev;
-	struct nes_mr temp_nesmr = *nesmr;
+	struct nes_adapter *nesadapter = nesdev->nesadapter;
 	int i = 0;
 
-	temp_nesmr.ibmw.device = ibfmr->device;
-	temp_nesmr.ibmw.pd = ibfmr->pd;
-	temp_nesmr.ibmw.rkey = ibfmr->rkey;
-	temp_nesmr.ibmw.uobject = NULL;
-
 	/* free the resources */
 	if (nesfmr->leaf_pbl_cnt == 0) {
 		/* single PBL case */
@@ -562,7 +557,17 @@ static int nes_dealloc_fmr(struct ib_fmr *ibfmr)
 				nesfmr->root_vpbl.pbl_pbase);
 	}
 
-	return nes_dealloc_mw(&temp_nesmr.ibmw);
+	nesmr->ibmw.device = ibfmr->device;
+	nesmr->ibmw.pd = ibfmr->pd;
+	nesmr->ibmw.rkey = ibfmr->rkey;
+	nesmr->ibmw.uobject = NULL;
+
+	if (nesfmr->nesmr.pbl_4k) {
+		nesadapter->free_4kpbl += nesfmr->nesmr.pbls_used;
+		BUG_ON(nesadapter->free_4kpbl > nesadapter->max_4kpbl);
+	}
+
+	return nes_dealloc_mw(&nesmr->ibmw);
 }
 
 



More information about the general mailing list