From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pd0-f180.google.com (mail-pd0-f180.google.com [209.85.192.180]) by dpdk.org (Postfix) with ESMTP id B1A555A44 for ; Wed, 22 Jul 2015 15:59:35 +0200 (CEST) Received: by pdbbh15 with SMTP id bh15so93569686pdb.1 for ; Wed, 22 Jul 2015 06:59:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=xPMfGApiVQAfJWz45T5QM/Q02dRjT5jdVe6a3nHKI/Y=; b=eV6Mxsu6lVeyipLMmFxrvRFhzYfuUrnCGzDKdccskpXT/YqnfBGYXUIiYwmv5dMp5w m1R2mrtPfNprnK6fao0JtcUJZuoVIYuzcXvONxS9FyQBNST5vlsywrbXF7Z+A/yjk4sd 2CSg1/uEi+c/c7QeNAu93bvxlHbMgu0NIMDxyUshvv+MVXatWL5fAyLliXP/YXJVP1hU CXVioNnuVRzMfwHdHBNX2P8lVhXLtV+Ul7E7IhsNL2IVfkG0k/EfTLkNG3nX/hw4Zq4b Ok0dU5eokWaJpfUoVlmBHnHP2HVAFtiEr/yZdJimyb8p5T/zq24UyJk0+naotbHooyB2 VjQQ== X-Received: by 10.66.222.41 with SMTP id qj9mr6245252pac.139.1437573575003; Wed, 22 Jul 2015 06:59:35 -0700 (PDT) Received: from localhost.localdomain (202-229-51-146.ap-p27.canvas.ne.jp. [202.229.51.146]) by smtp.gmail.com with ESMTPSA id bx7sm3550778pdb.82.2015.07.22.06.59.32 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 22 Jul 2015 06:59:33 -0700 (PDT) From: Yuichi Nakai To: dev@dpdk.org Date: Wed, 22 Jul 2015 22:57:00 +0900 Message-Id: <1437573420-16230-1-git-send-email-xoxyuxu@gmail.com> X-Mailer: git-send-email 1.9.1 Subject: [dpdk-dev] [PATCH] mempool: fix calculating address of object trailers X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Jul 2015 13:59:36 -0000 __mempool_get_trailer() calculated header's address. The address of trailer should set after element area. This patch fixes this calculating. This issue was mixed with the following commit: Fixes: 97e7e685bfcd ("mempool: add structure for object trailers") Signed-off-by: Yuichi Nakai --- lib/librte_mempool/rte_mempool.h | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/librte_mempool/rte_mempool.h b/lib/librte_mempool/rte_mempool.h index ee67ce7..075bcdf 100644 --- a/lib/librte_mempool/rte_mempool.h +++ b/lib/librte_mempool/rte_mempool.h @@ -271,12 +271,6 @@ static inline struct rte_mempool_objhdr *__mempool_get_header(void *obj) return RTE_PTR_SUB(obj, sizeof(struct rte_mempool_objhdr)); } -/* return the trailer of a mempool object (internal) */ -static inline struct rte_mempool_objtlr *__mempool_get_trailer(void *obj) -{ - return RTE_PTR_SUB(obj, sizeof(struct rte_mempool_objtlr)); -} - /** * Return a pointer to the mempool owning this object. * @@ -292,6 +286,13 @@ static inline struct rte_mempool *rte_mempool_from_obj(void *obj) return hdr->mp; } +/* return the trailer of a mempool object (internal) */ +static inline struct rte_mempool_objtlr *__mempool_get_trailer(void *obj) +{ + struct rte_mempool *mp = rte_mempool_from_obj(obj); + return RTE_PTR_ADD(obj, mp->elt_size); +} + /** * @internal Check and update cookies or panic. * -- 1.9.1