From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dispatch1-us1.ppe-hosted.com (dispatch1-us1.ppe-hosted.com [67.231.154.164]) by dpdk.org (Postfix) with ESMTP id AD78F1B00B; Thu, 1 Feb 2018 15:02:48 +0100 (CET) X-Virus-Scanned: Proofpoint Essentials engine Received: from webmail.solarflare.com (webmail.solarflare.com [12.187.104.26]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1-us1.ppe-hosted.com (Proofpoint Essentials ESMTP Server) with ESMTPS id D3DCCB000B6; Thu, 1 Feb 2018 14:02:44 +0000 (UTC) Received: from ocex03.SolarFlarecom.com (10.20.40.36) by ocex03.SolarFlarecom.com (10.20.40.36) with Microsoft SMTP Server (TLS) id 15.0.1044.25; Thu, 1 Feb 2018 06:02:32 -0800 Received: from opal.uk.solarflarecom.com (10.17.10.1) by ocex03.SolarFlarecom.com (10.20.40.36) with Microsoft SMTP Server (TLS) id 15.0.1044.25 via Frontend Transport; Thu, 1 Feb 2018 06:02:32 -0800 Received: from uklogin.uk.solarflarecom.com (uklogin.uk.solarflarecom.com [10.17.10.10]) by opal.uk.solarflarecom.com (8.13.8/8.13.8) with ESMTP id w11E2Vcd013211; Thu, 1 Feb 2018 14:02:31 GMT Received: from uklogin.uk.solarflarecom.com (localhost.localdomain [127.0.0.1]) by uklogin.uk.solarflarecom.com (8.13.8/8.13.8) with ESMTP id w11E2VQu018693; Thu, 1 Feb 2018 14:02:31 GMT From: Andrew Rybchenko To: CC: Olivier Matz , Santosh Shukla , Date: Thu, 1 Feb 2018 14:02:23 +0000 Message-ID: <1517493743-18585-1-git-send-email-arybchenko@solarflare.com> X-Mailer: git-send-email 1.8.2.3 In-Reply-To: <1516713372-10572-2-git-send-email-arybchenko@solarflare.com> References: <1516713372-10572-2-git-send-email-arybchenko@solarflare.com> MIME-Version: 1.0 Content-Type: text/plain X-MDID: 1517493768-xYd46Tj3hZQA Subject: [dpdk-stable] [PATCH] mempool: fix phys contig check if populate default skipped X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2018 14:02:48 -0000 There is not specified dependency between rte_mempool_populate_default() and rte_mempool_populate_iova(). So, the second should not rely on the fact that the first adds capability flags to the mempool flags. Fixes: 65cf769f5e6a ("mempool: detect physical contiguous objects") Cc: stable@dpdk.org Signed-off-by: Andrew Rybchenko Acked-by: Santosh Shukla --- lib/librte_mempool/rte_mempool.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/lib/librte_mempool/rte_mempool.c b/lib/librte_mempool/rte_mempool.c index 6fdb723..54f7f4b 100644 --- a/lib/librte_mempool/rte_mempool.c +++ b/lib/librte_mempool/rte_mempool.c @@ -333,6 +333,7 @@ rte_mempool_populate_iova(struct rte_mempool *mp, char *vaddr, void *opaque) { unsigned total_elt_sz; + unsigned int mp_capa_flags; unsigned i = 0; size_t off; struct rte_mempool_memhdr *memhdr; @@ -357,8 +358,17 @@ rte_mempool_populate_iova(struct rte_mempool *mp, char *vaddr, total_elt_sz = mp->header_size + mp->elt_size + mp->trailer_size; + /* Get mempool capabilities */ + mp_capa_flags = 0; + ret = rte_mempool_ops_get_capabilities(mp, &mp_capa_flags); + if ((ret < 0) && (ret != -ENOTSUP)) + return ret; + + /* update mempool capabilities */ + mp->flags |= mp_capa_flags; + /* Detect pool area has sufficient space for elements */ - if (mp->flags & MEMPOOL_F_CAPA_PHYS_CONTIG) { + if (mp_capa_flags & MEMPOOL_F_CAPA_PHYS_CONTIG) { if (len < total_elt_sz * mp->size) { RTE_LOG(ERR, MEMPOOL, "pool area %" PRIx64 " not enough\n", @@ -378,7 +388,7 @@ rte_mempool_populate_iova(struct rte_mempool *mp, char *vaddr, memhdr->free_cb = free_cb; memhdr->opaque = opaque; - if (mp->flags & MEMPOOL_F_CAPA_BLK_ALIGNED_OBJECTS) + if (mp_capa_flags & MEMPOOL_F_CAPA_BLK_ALIGNED_OBJECTS) /* align object start address to a multiple of total_elt_sz */ off = total_elt_sz - ((uintptr_t)vaddr % total_elt_sz); else if (mp->flags & MEMPOOL_F_NO_CACHE_ALIGN) -- 2.7.4