From patchwork Fri Dec 21 11:29:02 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Burakov, Anatoly" X-Patchwork-Id: 49233 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id D3BF21BDD6; Fri, 21 Dec 2018 12:29:12 +0100 (CET) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by dpdk.org (Postfix) with ESMTP id E67C11BD7F for ; Fri, 21 Dec 2018 12:29:07 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 21 Dec 2018 03:29:06 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,381,1539673200"; d="scan'208";a="112372699" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by orsmga003.jf.intel.com with ESMTP; 21 Dec 2018 03:29:05 -0800 Received: from sivswdev05.ir.intel.com (sivswdev05.ir.intel.com [10.243.17.64]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id wBLBT59Y023514; Fri, 21 Dec 2018 11:29:05 GMT Received: from sivswdev05.ir.intel.com (localhost [127.0.0.1]) by sivswdev05.ir.intel.com with ESMTP id wBLBT4cK002063; Fri, 21 Dec 2018 11:29:04 GMT Received: (from aburakov@localhost) by sivswdev05.ir.intel.com with LOCAL id wBLBT4Me002059; Fri, 21 Dec 2018 11:29:04 GMT From: Anatoly Burakov To: dev@dpdk.org Cc: thomas@monjalon.net, stephen@networkplumber.org Date: Fri, 21 Dec 2018 11:29:02 +0000 Message-Id: X-Mailer: git-send-email 1.7.0.7 In-Reply-To: References: In-Reply-To: References: Subject: [dpdk-dev] [PATCH v2 3/4] test/extmem: check if memseg list is external X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Extend the extmem autotest to check whether the memseg lists for externally allocated memory are always marked as external. Signed-off-by: Anatoly Burakov --- test/test/test_external_mem.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/test/test/test_external_mem.c b/test/test/test_external_mem.c index 06e6ccc1d..b877f8e2e 100644 --- a/test/test/test_external_mem.c +++ b/test/test/test_external_mem.c @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -29,11 +30,19 @@ check_mem(void *addr, rte_iova_t *iova, size_t pgsz, int n_pages) /* check that we can get this memory from EAL now */ for (i = 0; i < n_pages; i++) { + const struct rte_memseg_list *msl; const struct rte_memseg *ms; void *cur = RTE_PTR_ADD(addr, pgsz * i); rte_iova_t expected_iova; - ms = rte_mem_virt2memseg(cur, NULL); + msl = rte_mem_virt2memseg_list(cur); + if (!msl->external) { + printf("%s():%i: Memseg list is not marked as external\n", + __func__, __LINE__); + return -1; + } + + ms = rte_mem_virt2memseg(cur, msl); if (ms == NULL) { printf("%s():%i: Failed to retrieve memseg for external mem\n", __func__, __LINE__);