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 5F8D1A0524; Fri, 8 Jan 2021 15:03:12 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C28B8140EEA; Fri, 8 Jan 2021 15:03:11 +0100 (CET) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by mails.dpdk.org (Postfix) with ESMTP id 9BAF5140EDB for ; Fri, 8 Jan 2021 15:03:10 +0100 (CET) IronPort-SDR: ZVW+2jf0ArOyGxh03Pwjt5CvjUEnfp2LXeQHXuJANTuSDPo2wuzjG0qvWXpn/79wAd7J4deSfj xvBmaWz55ItQ== X-IronPort-AV: E=McAfee;i="6000,8403,9857"; a="174089538" X-IronPort-AV: E=Sophos;i="5.79,331,1602572400"; d="scan'208";a="174089538" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Jan 2021 06:03:09 -0800 IronPort-SDR: nb/+R9qLcDs1DoXZaLyKPEJZnQgPHchzZdvXXGI7CAGQyBIVAuc/2+ZDJXg4pwLUSFYw6IGVUz I4wPzG9ekBrw== X-IronPort-AV: E=Sophos;i="5.79,331,1602572400"; d="scan'208";a="351687224" Received: from bricha3-mobl.ger.corp.intel.com ([10.252.4.119]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-SHA; 08 Jan 2021 06:03:08 -0800 Date: Fri, 8 Jan 2021 14:03:05 +0000 From: Bruce Richardson To: Kumar Amber Cc: dev@dpdk.org Message-ID: <20210108140305.GA1823@bricha3-MOBL.ger.corp.intel.com> References: <20210107122312.564619-1-kumar.amber@intel.com> <20210108134456.636211-1-kumar.amber@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210108134456.636211-1-kumar.amber@intel.com> Subject: Re: [dpdk-dev] [PATCH v8] 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" On Fri, Jan 08, 2021 at 07:14:56PM +0530, Kumar Amber wrote: > 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 > --- > drivers/raw/ioat/ioat_common.c | 16 ++++++++++++++++ > drivers/raw/ioat/ioat_rawdev.c | 15 +++++++++++++++ > 2 files changed, 31 insertions(+) > > diff --git a/drivers/raw/ioat/ioat_common.c b/drivers/raw/ioat/ioat_common.c > index 142e171bc9..da464181a5 100644 > --- a/drivers/raw/ioat/ioat_common.c > +++ b/drivers/raw/ioat/ioat_common.c > @@ -215,14 +215,30 @@ 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; > + rawdev->dev_ops = ops; > + rawdev->device = dev; > + return 0; > + } This block you inserted still needs to go two lines further up. > if (mz == NULL) { > IOAT_PMD_ERR("Unable to reserve memzone for private data\n"); > ret = -ENOMEM; > goto cleanup; > } > + You don't need this newline addition. > 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..922fa20e32 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; > + rawdev->dev_ops = &ioat_rawdev_ops; > + rawdev->device = &dev->device; > + return 0; > + } As above, these new lines need to be inserted where they were in the previous version. > if (mz == NULL) { > IOAT_PMD_ERR("Unable to reserve memzone for private data\n"); > ret = -ENOMEM; > -- > 2.25.1 >