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 C5E4FA09FF; Thu, 7 Jan 2021 05:08:58 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4A41B140E78; Thu, 7 Jan 2021 05:08:58 +0100 (CET) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by mails.dpdk.org (Postfix) with ESMTP id 5DC77140E71 for ; Thu, 7 Jan 2021 05:08:56 +0100 (CET) IronPort-SDR: dilaFmuhG4KmIEL5QIoWOFUjDM2OKnFz1gowF7TTMGjuD/WeSKYAtWmDXb6kqAHV/dceJhMfR7 /TZfvkizVa6Q== X-IronPort-AV: E=McAfee;i="6000,8403,9856"; a="157154255" X-IronPort-AV: E=Sophos;i="5.79,328,1602572400"; d="scan'208";a="157154255" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Jan 2021 20:08:54 -0800 IronPort-SDR: jFDpx5cOWUrDv8NRQ7nlVa+uD3dhJE4i1ssOq/hk+0Uxr2tjQmS2e0JWlASEJFwtB1tCSmFO3c QkEZZT8IYXFw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.79,328,1602572400"; d="scan'208";a="462899423" Received: from bmca4bf01706bbf.iind.intel.com (HELO localhost.localdomain) ([10.190.213.111]) by fmsmga001.fm.intel.com with ESMTP; 06 Jan 2021 20:08:53 -0800 From: Kumar Amber To: dev@dpdk.org Date: Thu, 7 Jan 2021 09:30:59 +0530 Message-Id: <20210107040059.551965-1-kumar.amber@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210104163049.304493-1-kumar.amber@intel.com> References: <20210104163049.304493-1-kumar.amber@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v5] 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" Add support for secondary processes in ioat devices. The update allocates a memzone for a primary process or returns it in a secondary process. Signed-off-by: Kumar Amber --- v5 * add error check for memzone lookup --- drivers/raw/ioat/ioat_common.c | 21 +++++++++++++++++++-- drivers/raw/ioat/ioat_rawdev.c | 19 +++++++++++++++++-- 2 files changed, 36 insertions(+), 4 deletions(-) diff --git a/drivers/raw/ioat/ioat_common.c b/drivers/raw/ioat/ioat_common.c index 142e171bc9..91f0d5122c 100644 --- a/drivers/raw/ioat/ioat_common.c +++ b/drivers/raw/ioat/ioat_common.c @@ -215,14 +215,31 @@ idxd_rawdev_create(const char *name, struct rte_device *dev, goto cleanup; } + /* Allocate memory for the primary process or else return the memory + * of primary memzone for the 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); + if (mz == NULL) { + IOAT_PMD_ERR("Unable lookup memzone for private data\n"); + ret = -ENOMEM; + goto cleanup; + } + } + 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"); ret = -ENOMEM; goto cleanup; } + rawdev->dev_private = mz->addr; rawdev->dev_ops = ops; rawdev->device = dev; diff --git a/drivers/raw/ioat/ioat_rawdev.c b/drivers/raw/ioat/ioat_rawdev.c index 2c88b4369f..a9846e75f2 100644 --- a/drivers/raw/ioat/ioat_rawdev.c +++ b/drivers/raw/ioat/ioat_rawdev.c @@ -165,9 +165,24 @@ ioat_rawdev_create(const char *name, struct rte_pci_device *dev) goto cleanup; } + /* Allocate memory for the primary process or else return the memory + * of primary memzone for the 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); + if (mz == NULL) { + IOAT_PMD_ERR("Unable lookup memzone for private data\n"); + ret = -ENOMEM; + goto cleanup; + } + 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"); ret = -ENOMEM; -- 2.25.1