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 A4CC8A0524; Fri, 8 Jan 2021 18:00:29 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 68FA2140E3D; Fri, 8 Jan 2021 18:00:28 +0100 (CET) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mails.dpdk.org (Postfix) with ESMTP id 13BA4140E33 for ; Fri, 8 Jan 2021 18:00:25 +0100 (CET) IronPort-SDR: moKYSWVZBYN6Ysrp7hwRDFnW8Y17I7EhQXnEVxkz0hMlSfSMc+1WrTeGiFE8uCwPnC7pW74z21 v2B9K220hWxQ== X-IronPort-AV: E=McAfee;i="6000,8403,9858"; a="176846398" X-IronPort-AV: E=Sophos;i="5.79,331,1602572400"; d="scan'208";a="176846398" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Jan 2021 09:00:24 -0800 IronPort-SDR: 1ZMaP91hTeWVV3Uo//QwEr1EH8Cv4+xkd30AgDqO23oBJBKUXDigvpv/0XcGy8/kSqxKxHQCYB DSGrAx9CdfoQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.79,331,1602572400"; d="scan'208";a="388234633" Received: from bmca4bf01706bbf.iind.intel.com (HELO localhost.localdomain) ([10.190.213.111]) by orsmga007.jf.intel.com with ESMTP; 08 Jan 2021 09:00:24 -0800 From: Kumar Amber To: dev@dpdk.org Date: Fri, 8 Jan 2021 22:22:16 +0530 Message-Id: <20210108165216.649086-1-kumar.amber@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210108160854.639870-1-kumar.amber@intel.com> References: <20210108160854.639870-1-kumar.amber@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v9] 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 v6 * fix compilation v7 * include dev ops for secondary v8 * fix wrong memzone alloaction v9 * fix comments --- drivers/raw/ioat/ioat_common.c | 15 +++++++++++++++ drivers/raw/ioat/ioat_rawdev.c | 15 +++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/drivers/raw/ioat/ioat_common.c b/drivers/raw/ioat/ioat_common.c index 142e171bc9..d055c36a2a 100644 --- a/drivers/raw/ioat/ioat_common.c +++ b/drivers/raw/ioat/ioat_common.c @@ -215,7 +215,22 @@ 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); + 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; + rawdev->dev_ops = ops; + rawdev->device = dev; + return 0; + } mz = rte_memzone_reserve(mz_name, sizeof(struct idxd_rawdev), dev->numa_node, RTE_MEMZONE_IOVA_CONTIG); if (mz == NULL) { diff --git a/drivers/raw/ioat/ioat_rawdev.c b/drivers/raw/ioat/ioat_rawdev.c index 2c88b4369f..77216f67f5 100644 --- a/drivers/raw/ioat/ioat_rawdev.c +++ b/drivers/raw/ioat/ioat_rawdev.c @@ -165,7 +165,22 @@ 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); + 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; + rawdev->dev_ops = &ioat_rawdev_ops; + rawdev->device = &dev->device; + return 0; + } mz = rte_memzone_reserve(mz_name, sizeof(struct rte_ioat_rawdev), dev->device.numa_node, RTE_MEMZONE_IOVA_CONTIG); if (mz == NULL) { -- 2.25.1