From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 9C01EA034F;
	Fri,  8 Oct 2021 12:56:08 +0200 (CEST)
Received: from [217.70.189.124] (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id 08CA341125;
	Fri,  8 Oct 2021 12:55:59 +0200 (CEST)
Received: from mail-pf1-f180.google.com (mail-pf1-f180.google.com
 [209.85.210.180])
 by mails.dpdk.org (Postfix) with ESMTP id 57F2F41223
 for <dev@dpdk.org>; Thu,  7 Oct 2021 20:44:19 +0200 (CEST)
Received: by mail-pf1-f180.google.com with SMTP id i65so3125466pfe.12
 for <dev@dpdk.org>; Thu, 07 Oct 2021 11:44:19 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=oneconvergence.com; s=google;
 h=from:to:cc:subject:date:message-id:in-reply-to:references
 :mime-version:content-transfer-encoding;
 bh=C87LG3KPv1Hn8RRI3PPjDZFQlbfxFiUHV1O/36L6ey8=;
 b=ZAVqoabcsGxGWQrj4NxiFdYy1NouNnCx5Yq2KrVzqdyd2j7Y51fypx6Pepox96PFDg
 Qkn/NguEVqBebMwnDAJIyfQyd/4kURXmTu+DTRcExmeIeJ6MlQrcMcdGG5gkgRFdBjej
 haLwigGpymeC8hDuTxhpLndTTuXdSpS7mTHIY=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to
 :references:mime-version:content-transfer-encoding;
 bh=C87LG3KPv1Hn8RRI3PPjDZFQlbfxFiUHV1O/36L6ey8=;
 b=ixxWR+r5nlvgGBEVPOvZraCAY+UdXguOqKoxXTKn+lt1K9e5Gx/IeDqHpsvxPXfS/8
 eR+q3AxNSqRO//QMIhX2jbsGHs4mCSHbmfrzLEXYterR4wQJ7kzgp6rqhlTnZp4/vqTm
 QoO8kJ5TBbmqpKw0cnWCW7KVEoW6eNuAUxCN39AM4FvocvFZSz+leIfDtcRE1iG8mM/e
 X1NW3/0kSpIXNiLpU6u0zmXmwZEr7sAOHvhnTKC6iloTdnKJ02mDPrgJA2fv3H7w8Mzx
 bPVoNLuv4K95XducdfiGt0VhjH/5CT+B92Ul6LR9QQC1/W6Q56rnN9JNb1rQgPxbfGvZ
 tAGQ==
X-Gm-Message-State: AOAM5322Xz0keiKL3knbUXMNGncyjIT07dmWBjMToQq8eH0x8vRZV3ln
 jG3woEN0zXhdETkiLX7U73oB6cGICznpXw==
X-Google-Smtp-Source: ABdhPJyw4Zei7yjJ4OCzbtm88tiCPYZumQsKH8/zSSG3YBFKoulTNvVTqiSSCb9qq5oldXEP1AyvUw==
X-Received: by 2002:a62:1786:0:b0:445:1a9c:952a with SMTP id
 128-20020a621786000000b004451a9c952amr5993417pfx.39.1633632258558; 
 Thu, 07 Oct 2021 11:44:18 -0700 (PDT)
Received: from srikanth-ThinkPad-T450.domain.name ([136.185.113.102])
 by smtp.gmail.com with ESMTPSA id c11sm3311586pji.38.2021.10.07.11.44.15
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 07 Oct 2021 11:44:17 -0700 (PDT)
From: Srikanth Kaka <srikanth.k@oneconvergence.com>
To: Matan Azrad <matan@nvidia.com>,
 Viacheslav Ovsiienko <viacheslavo@nvidia.com>
Cc: dev@dpdk.org, Vag Singh <vag.singh@oneconvergence.com>,
 Anand Thulasiram <avelu@juniper.net>,
 Srikanth Kaka <srikanth.k@oneconvergence.com>
Date: Fri,  8 Oct 2021 00:13:11 +0530
Message-Id: <20211007184350.73858-3-srikanth.k@oneconvergence.com>
X-Mailer: git-send-email 2.30.2
In-Reply-To: <20211007184350.73858-1-srikanth.k@oneconvergence.com>
References: <20211007184350.73858-1-srikanth.k@oneconvergence.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Mailman-Approved-At: Fri, 08 Oct 2021 12:55:54 +0200
Subject: [dpdk-dev] [PATCH v2 02/41] common/mlx5: add memory APIs
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>

Add mlx5_os_malloc() & mlx5_os_free() APIs

Signed-off-by: Srikanth Kaka <srikanth.k@oneconvergence.com>
Signed-off-by: Vag Singh <vag.singh@oneconvergence.com>
Signed-off-by: Anand Thulasiram <avelu@juniper.net>
---
 drivers/common/mlx5/freebsd/mlx5_common_os.h | 46 ++++++++++++++++++++
 1 file changed, 46 insertions(+)
 create mode 100644 drivers/common/mlx5/freebsd/mlx5_common_os.h

diff --git a/drivers/common/mlx5/freebsd/mlx5_common_os.h b/drivers/common/mlx5/freebsd/mlx5_common_os.h
new file mode 100644
index 0000000000..0bf22e016a
--- /dev/null
+++ b/drivers/common/mlx5/freebsd/mlx5_common_os.h
@@ -0,0 +1,46 @@
+
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright 2020 Mellanox Technologies, Ltd
+ */
+
+#ifndef RTE_PMD_MLX5_COMMON_OS_H_
+#define RTE_PMD_MLX5_COMMON_OS_H_
+
+#include <stdio.h>
+
+/**
+ * Memory allocation optionally with alignment.
+ *
+ * @param[in] align
+ *    Alignment size (may be zero)
+ * @param[in] size
+ *    Size in bytes to allocate
+ *
+ * @return
+ *    Valid pointer to allocated memory, NULL in case of failure
+ */
+static inline void *
+mlx5_os_malloc(size_t align, size_t size)
+{
+	void *buf;
+
+	if (posix_memalign(&buf, align, size))
+		return NULL;
+	return buf;
+}
+
+/**
+ * This API de-allocates a memory that originally could have been
+ * allocated aligned or non-aligned. In Linux it is a wrapper
+ * around free().
+ *
+ * @param[in] addr
+ *    Pointer to address to free
+ *
+ */
+static inline void
+mlx5_os_free(void *addr)
+{
+	free(addr);
+}
+#endif /* RTE_PMD_MLX5_COMMON_OS_H_ */
-- 
2.30.2