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 4DCD2A046B for ; Fri, 28 Jun 2019 18:21:37 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 630584C8E; Fri, 28 Jun 2019 18:21:36 +0200 (CEST) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id CC8ED4C6C for ; Fri, 28 Jun 2019 18:21:34 +0200 (CEST) X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 28 Jun 2019 09:21:34 -0700 X-IronPort-AV: E=Sophos;i="5.63,428,1557212400"; d="scan'208";a="185685455" Received: from bricha3-mobl.ger.corp.intel.com ([10.252.21.39]) by fmsmga004-auth.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 28 Jun 2019 09:21:32 -0700 Date: Fri, 28 Jun 2019 17:21:28 +0100 From: Bruce Richardson To: "Burakov, Anatoly" Cc: dev@dpdk.org, thomas@monjalon.net, jerinj@marvell.com Message-ID: <20190628162128.GB366@bricha3-MOBL.ger.corp.intel.com> References: <20190530212525.40370-1-bruce.richardson@intel.com> <20190627104055.8244-1-bruce.richardson@intel.com> <20190627104055.8244-5-bruce.richardson@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.11.4 (2019-03-13) Subject: Re: [dpdk-dev] [PATCH v3 4/8] raw/ioat: create device on probe and destroy on release 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" On Thu, Jun 27, 2019 at 01:09:03PM +0100, Burakov, Anatoly wrote: > On 27-Jun-19 11:40 AM, Bruce Richardson wrote: > > Add the create/destroy driver functions so that we can actually allocate > > a rawdev and destroy it when done. No rawdev API functions are actually > > implemented at this point. > > > > Signed-off-by: Bruce Richardson > > --- > > > > > ioat_rawdev_create(const char *name, struct rte_pci_device *dev) > > { > > - RTE_SET_USED(name); > > - RTE_SET_USED(dev); > > + static const struct rte_rawdev_ops ioat_rawdev_ops = { > > + }; > > + > > + struct rte_rawdev *rawdev = NULL; > > + struct rte_ioat_rawdev *ioat = NULL; > > + int ret = 0; > > + int retry = 0; > > + > > + if (!name) { > > + IOAT_PMD_ERR("Invalid name of the device!"); > > + ret = -EINVAL; > > + goto cleanup; > > + } > > Is checking `dev` not necessary here? > No, the only place it's called from is already using the PCI device structure. I don't think the probe function can ever be called with a NULL parameter. > > + > > + /* Allocate device structure */ > > + rawdev = rte_rawdev_pmd_allocate(name, sizeof(struct rte_ioat_rawdev), > > + dev->device.numa_node); > > + if (rawdev == NULL) { > > + IOAT_PMD_ERR("Unable to allocate raw device"); > > + ret = -EINVAL; > > + goto cleanup; > > EINVAL is supposed to be used to indicate invalid arguments. Inability to > allocate is not an "invalid arguments" condition. Does > rte_rawdev_pmd_allocate() set its own errno value? If so, perhaps it would > be worth passing it on? If not, perhaps -ENOMEM would be a better return > value? > Fixing in v4.