From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 375AAA04B1; Thu, 24 Sep 2020 12:40:08 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 31F211DDD0; Thu, 24 Sep 2020 12:40:07 +0200 (CEST) Received: from mail-wm1-f65.google.com (mail-wm1-f65.google.com [209.85.128.65]) by dpdk.org (Postfix) with ESMTP id 4B79A1DD97 for ; Thu, 24 Sep 2020 12:40:05 +0200 (CEST) Received: by mail-wm1-f65.google.com with SMTP id s13so2993989wmh.4 for ; Thu, 24 Sep 2020 03:40:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=emumba-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Msm6es7OG5LoN2gXnzaEqvVMBLRTjjc73mY0geRLwNY=; b=O8y42vnqrIyX7CCYgnRVJRel0rhY9RbWmPAIJVyaMwA+Qgu8n2JVFKXichfP0pnf4S I7v0+AusoFy4el8mKstdLnFKFyaXR3F+PGvRIDlQbdZdZ5zvwiaD8iujhAlXdRYz+ZL6 996EkKch+SBUGBNhTMLZNFzOZvctVb5nVRzVsLNtvr+As6IuNT4cy5WtrUCOkqX2tUno urSigNknCatQfPgQEKI0KfUi1z9mVCrVPI4Mic3bNl8+huFcq0CgR08ExZlcJNYqXm4m eTei2ynQeJPWL5tvPMJFVFNEbzp8Lz+ooBqcRsUwk4pSO80qbtcORO2aoL1EebfIoJRd WEfw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Msm6es7OG5LoN2gXnzaEqvVMBLRTjjc73mY0geRLwNY=; b=rHQaUOg8qMIsDsyQwoqk6PoZym8RVC+KWau+mX0U/5A2gRm73L5P51P4HLE8lEKmYy SWT3a/yPaF9R43YXeslMBpmFCGVPPJMq9qNW0A+KbaMq1+nFv4yVgjSIPw19uwaaXwTb v7IvkXng2pOkt9Prw8lSwhIX8V3PzJ4sOm7gM/jDpOV+POk9l6COfzKWc+xMi+jid2Ly b3CEyR9fJzM6lbd3PVNyZTSaUOa0+yOG7gYSywdBVBow8sRL2tsHoM82CLXuJKSSfvf1 IBlNyz4vnOZgcAXmCIOHvo/1XBiq53JKtkfxWqOH4KHZDyb5bYck78GsKlCzTcbc4mx+ R7/Q== X-Gm-Message-State: AOAM530J/62csd3g0XifG26DqaW/2MsT1BaiJYR9uY/yIAo7aBUn05rf woH40Rt2xErRvKB1C9e3cfdpLQ== X-Google-Smtp-Source: ABdhPJzl3IuBUYMhSxv7x3XhJGjvqz/mMf3N0ENiT9SRN3jc0Emlf0U00tsVuwNImnAlNXSTbvadtg== X-Received: by 2002:a1c:1f42:: with SMTP id f63mr3928947wmf.1.1600944004832; Thu, 24 Sep 2020 03:40:04 -0700 (PDT) Received: from localhost.localdomain (115-186-191-45.nayatel.pk. [115.186.191.45]) by smtp.gmail.com with ESMTPSA id v2sm3085342wrm.16.2020.09.24.03.40.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Sep 2020 03:40:04 -0700 (PDT) From: Sarosh Arif To: jerinj@marvell.com, ndabilpuram@marvell.com Cc: dev@dpdk.org, Sarosh Arif Date: Thu, 24 Sep 2020 15:39:32 +0500 Message-Id: <20200924103932.3834392-1-sarosh.arif@emumba.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200713130053.31851-1-sarosh.arif@emumba.com> References: <20200713130053.31851-1-sarosh.arif@emumba.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v2] common/octeontx2: fix memory mapping API's usage 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" replace mmap() with rte_mem_map() and replace munmap() with rte_mem_unmap() Fixes: e1d9a02ad8f0 ("common/octeontx2: introduce common device class") Signed-off-by: Sarosh Arif --- v2: update description and commit message --- drivers/common/octeontx2/otx2_dev.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/common/octeontx2/otx2_dev.c b/drivers/common/octeontx2/otx2_dev.c index d61c712fa..6a84df234 100644 --- a/drivers/common/octeontx2/otx2_dev.c +++ b/drivers/common/octeontx2/otx2_dev.c @@ -11,6 +11,7 @@ #include #include #include +#include #include "otx2_dev.h" #include "otx2_mbox.h" @@ -34,10 +35,11 @@ mbox_mem_map(off_t off, size_t size) if (mem_fd < 0) goto error; - va = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, mem_fd, off); + va = rte_mem_map(NULL, size, RTE_PROT_READ | RTE_PROT_WRITE, + RTE_MAP_SHARED, mem_fd, off); close(mem_fd); - if (va == MAP_FAILED) + if (va == NULL) otx2_err("Failed to mmap sz=0x%zx, fd=%d, off=%jd", size, mem_fd, (intmax_t)off); error: @@ -48,7 +50,7 @@ static void mbox_mem_unmap(void *va, size_t size) { if (va) - munmap(va, size); + rte_mem_unmap(va, size); } static int -- 2.25.1