From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (xvm-189-124.dc0.ghst.net [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 5EF8CA09FF; Mon, 4 Jan 2021 14:39:02 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8A05A160716; Mon, 4 Jan 2021 14:39:01 +0100 (CET) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by mails.dpdk.org (Postfix) with ESMTP id ECD7C160712 for ; Mon, 4 Jan 2021 14:38:59 +0100 (CET) IronPort-SDR: 96rqT9+oHzDQhGnAC0KADPU97nKp9ttVRUPcaZzFvGFnxbV03IXMEramDPrz+yzwVWV6+3ubeQ 1ukr3CcsYWFA== X-IronPort-AV: E=McAfee;i="6000,8403,9853"; a="177107238" X-IronPort-AV: E=Sophos;i="5.78,474,1599548400"; d="scan'208";a="177107238" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Jan 2021 05:38:58 -0800 IronPort-SDR: gu1qTOS1mrUCvrxT1H/P5vpNRvcJhBThCvaVzKSMgle0c72I+KtB3CtbKcjYww5oK2EtkbZCeo PCovzO+VO+6Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.78,474,1599548400"; d="scan'208";a="342801360" Received: from bmca4bf01706bbf.iind.intel.com (HELO localhost.localdomain) ([10.190.213.111]) by fmsmga007.fm.intel.com with ESMTP; 04 Jan 2021 05:38:57 -0800 From: Kumar Amber To: dev@dpdk.org Date: Mon, 4 Jan 2021 19:01:28 +0530 Message-Id: <20210104133128.286198-1-kumar.amber@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201121020952.29174-1-kumar.amber@intel.com> References: <20201121020952.29174-1-kumar.amber@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v2] raw/ioat: add secondary process support X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 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" Adds the check for the process type primary and secondary. Allocate memzone only in the primary porcess space and return the same memzone in secondary process. Signed-off-by: Kumar Amber --- drivers/raw/ioat/ioat_common.c | 17 ++++++++++++++--- drivers/raw/ioat/ioat_rawdev.c | 18 ++++++++++++++---- 2 files changed, 28 insertions(+), 7 deletions(-) diff --git a/drivers/raw/ioat/ioat_common.c b/drivers/raw/ioat/ioat_common.c index 142e171bc9..baa0e856f6 100644 --- a/drivers/raw/ioat/ioat_common.c +++ b/drivers/raw/ioat/ioat_common.c @@ -215,11 +215,22 @@ idxd_rawdev_create(const char *name, struct rte_device *dev, goto cleanup; } + /* allocate memory for primary process + * else return memory of primary + * memzone for secondary process + */ snprintf(mz_name, sizeof(mz_name), "rawdev%u_private", rawdev->dev_id); - mz = rte_memzone_reserve(mz_name, sizeof(struct idxd_rawdev), - dev->numa_node, RTE_MEMZONE_IOVA_CONTIG); + if (rte_eal_process_type() == RTE_PROC_SECONDARY) { + mz = rte_memzone_lookup(mz_name); + rawdev->dev_private = mz->addr; + return 0; + } + mz = rte_memzone_reserve(mz_name, + sizeof(struct rte_ioat_rawdev), + dev->numa_node, + RTE_MEMZONE_IOVA_CONTIG); if (mz == NULL) { - IOAT_PMD_ERR("Unable to reserve memzone for private data\n"); + IOAT_PMD_ERR("Unable to reserve memzone\n"); ret = -ENOMEM; goto cleanup; } diff --git a/drivers/raw/ioat/ioat_rawdev.c b/drivers/raw/ioat/ioat_rawdev.c index 2c88b4369f..76ed48d5a0 100644 --- a/drivers/raw/ioat/ioat_rawdev.c +++ b/drivers/raw/ioat/ioat_rawdev.c @@ -165,15 +165,25 @@ ioat_rawdev_create(const char *name, struct rte_pci_device *dev) goto cleanup; } + /* allocate memory for primary process + * else return memory of primary + * memzone for secondary process + */ snprintf(mz_name, sizeof(mz_name), "rawdev%u_private", rawdev->dev_id); - mz = rte_memzone_reserve(mz_name, sizeof(struct rte_ioat_rawdev), - dev->device.numa_node, RTE_MEMZONE_IOVA_CONTIG); + if (rte_eal_process_type() == RTE_PROC_SECONDARY) { + mz = rte_memzone_lookup(mz_name); + rawdev->dev_private = mz->addr; + return 0; + } + mz = rte_memzone_reserve(mz_name, + sizeof(struct rte_ioat_rawdev), + dev->device.numa_node, + RTE_MEMZONE_IOVA_CONTIG); if (mz == NULL) { - IOAT_PMD_ERR("Unable to reserve memzone for private data\n"); + IOAT_PMD_ERR("Unable to reserve memzone\n"); ret = -ENOMEM; goto cleanup; } - rawdev->dev_private = mz->addr; rawdev->dev_ops = &ioat_rawdev_ops; rawdev->device = &dev->device; -- 2.25.1