From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-we0-f171.google.com (mail-we0-f171.google.com [74.125.82.171]) by dpdk.org (Postfix) with ESMTP id BFF91B64A for ; Tue, 17 Feb 2015 01:47:01 +0100 (CET) Received: by mail-we0-f171.google.com with SMTP id p10so32144466wes.2 for ; Mon, 16 Feb 2015 16:47:01 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:organization :user-agent:in-reply-to:references:mime-version :content-transfer-encoding:content-type; bh=Foi5zHcya8BEYvvdubirtexUDBtiboBHSqmZNHeKTVQ=; b=DpYmqysgEtGI6tNR7tNlCszvQfFUYsyMzLUv9hB7wLafq+gSjoSR+/NmmDf2PQt8j/ SODjvHnAH4gNMVmz5ZyEhcAiyVBCd/eA6TXD9qb1w6/Y8fo6QkRp6LZRfZ7EAqn/ai/P DRbJRmP1iD+fOE/bpyHmbWPS0uqG6elKoTUoj1V/otgwx9vLgO6Tj22b80140uE7grT+ s+XN1M+k6COHASDhH4UJWA6WE1FD/V10FAZNLxrlqXtSvWcmRIMCIB0Iu5EpZtPLLrhi DK2ybLa0IpXsPhmRi32HtT7Wp9Xt6DJrT2npXNHdNknpYzoQd/2CbDFQH7FiBoVVMihy CHLA== X-Gm-Message-State: ALoCoQmsnTud82VxqMxWPBf6MxDle5wP5ip3mZ6Y7fxsbpSL35VSYGfjhw2waJyDl9KxRn337Iof X-Received: by 10.180.10.131 with SMTP id i3mr52858834wib.54.1424134021623; Mon, 16 Feb 2015 16:47:01 -0800 (PST) Received: from xps13.localnet (guy78-1-82-235-116-147.fbx.proxad.net. [82.235.116.147]) by mx.google.com with ESMTPSA id ha5sm5572432wib.1.2015.02.16.16.47.00 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 16 Feb 2015 16:47:00 -0800 (PST) From: Thomas Monjalon To: Tetsuya Mukawa Date: Tue, 17 Feb 2015 01:46:29 +0100 Message-ID: <5935372.TlW161azlx@xps13> Organization: 6WIND User-Agent: KMail/4.14.4 (Linux/3.18.4-1-ARCH; KDE/4.14.4; x86_64; ; ) In-Reply-To: <1424060073-23484-6-git-send-email-mukawa@igel.co.jp> References: <1423470639-15744-2-git-send-email-mukawa@igel.co.jp> <1424060073-23484-1-git-send-email-mukawa@igel.co.jp> <1424060073-23484-6-git-send-email-mukawa@igel.co.jp> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Cc: dev@dpdk.org Subject: Re: [dpdk-dev] [PATCH v8 05/14] ethdev: Add rte_eth_dev_free to free specified device X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Feb 2015 00:47:02 -0000 2015-02-16 13:14, Tetsuya Mukawa: > This patch adds rte_eth_dev_free(). The function is used for changing an > attached status of the device that has specified name. > > v6: > - Use rte_eth_dev structure as the paramter of rte_eth_dev_free(). > v4: > - Add parameter checking. > > Signed-off-by: Tetsuya Mukawa > --- > lib/librte_ether/rte_ethdev.c | 11 +++++++++++ > lib/librte_ether/rte_ethdev.h | 14 ++++++++++++++ > 2 files changed, 25 insertions(+) > > diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c > index a79fa5b..2463d18 100644 > --- a/lib/librte_ether/rte_ethdev.c > +++ b/lib/librte_ether/rte_ethdev.c > @@ -260,6 +260,17 @@ rte_eth_dev_allocate(const char *name) > return eth_dev; > } > > +int > +rte_eth_dev_free(struct rte_eth_dev *eth_dev) > +{ > + if (eth_dev == NULL) > + return -EINVAL; > + > + eth_dev->attached = 0; > + nb_ports--; > + return 0; > +} This function is strange. I would imagine it calling the free (uninit) function of the driver. [...] > +/** > + * Function for internal use by dummy drivers primarily, e.g. ring-based > + * driver. > + * Free the specified ethdev. > + * > + * @param eth_dev > + * The *eth_dev* pointer is the address of the *rte_eth_dev* structure > + * associated with the matching device and which have been [automatically] > + * allocated in the *rte_eth_devices* array. > + * @return > + * - 0 on success, negative on error > + */ > +int rte_eth_dev_free(struct rte_eth_dev *eth_dev); > + > struct eth_driver; > /** > * @internal >