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 AFE24A04DD; Sat, 21 Nov 2020 03:16:50 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 66ED1F90; Sat, 21 Nov 2020 03:16:48 +0100 (CET) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by dpdk.org (Postfix) with ESMTP id F3E3C2AB for ; Sat, 21 Nov 2020 03:16:44 +0100 (CET) IronPort-SDR: /EJgOl5kRXppBfgYtCz5j4G8QYDcHDOznZomLwlV6/j/GMF427438+CkYugC8OXj6sxTmXopCI owcCX2GR2ISg== X-IronPort-AV: E=McAfee;i="6000,8403,9811"; a="151413436" X-IronPort-AV: E=Sophos;i="5.78,357,1599548400"; d="scan'208";a="151413436" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Nov 2020 18:16:44 -0800 IronPort-SDR: 6UBVuqJI489fujfjEyL8T69QTwGdNd76hkamYIPh4v0aRvooUQo2PskXqOYurKziu+Y/G+9HjG pDpqX25XwWhQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.78,357,1599548400"; d="scan'208";a="311631285" Received: from unknown (HELO localhost.localdomain) ([10.190.212.185]) by fmsmga008.fm.intel.com with ESMTP; 20 Nov 2020 18:16:43 -0800 From: Kumar Amber To: dev@dpdk.org Date: Sat, 21 Nov 2020 07:39:52 +0530 Message-Id: <20201121020952.29174-1-kumar.amber@intel.com> X-Mailer: git-send-email 2.17.1 Subject: [dpdk-dev] [PATCH v1] raw/ioat: add secondary process support 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" add the secondart process support in dsa and ioat for cbdma Signed-off-by: Kumar Amber --- drivers/raw/ioat/ioat_common.c | 18 +++++++++++++++--- drivers/raw/ioat/ioat_rawdev.c | 19 +++++++++++++++---- 2 files changed, 30 insertions(+), 7 deletions(-) diff --git a/drivers/raw/ioat/ioat_common.c b/drivers/raw/ioat/ioat_common.c index 142e171bc9..e5a0bac8ab 100644 --- a/drivers/raw/ioat/ioat_common.c +++ b/drivers/raw/ioat/ioat_common.c @@ -215,11 +215,23 @@ idxd_rawdev_create(const char *name, struct rte_device *dev, goto cleanup; } + /* + * Check for primary than allocate memory + * else return the memory from primary + * memzone. + */ 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..0fd9ebc60d 100644 --- a/drivers/raw/ioat/ioat_rawdev.c +++ b/drivers/raw/ioat/ioat_rawdev.c @@ -165,15 +165,26 @@ ioat_rawdev_create(const char *name, struct rte_pci_device *dev) goto cleanup; } + /* + * Check for primary than allocate memory + * else return the memory from primary + * memzone. + */ 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.17.1