From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f48.google.com (mail-wm0-f48.google.com [74.125.82.48]) by dpdk.org (Postfix) with ESMTP id 6C85F902 for ; Thu, 6 Oct 2016 16:52:49 +0200 (CEST) Received: by mail-wm0-f48.google.com with SMTP id i130so8943985wmg.1 for ; Thu, 06 Oct 2016 07:52:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:user-agent:in-reply-to :references:mime-version:content-transfer-encoding; bh=/yu8oJIBffJ4JRqiYVpiraykoG8eebIqxgn7sbcB6vI=; b=xMWN4Nu38auWkZxYs/10BgX2Im5YFJebpkF7+Ag24Sjat9IPtU2nMvBiBF0ztAsBtu 7HiOKltLl6Q7ac4UH/bSWe+i7vP6TzNgtqvHyPH1TBKresV3lRWFFDFGzenFcP/QW6P3 NJBnNxt+7+1y6WiXgXO9V+LynaV7QpghAY70+Osl2Y0M4/A8zwJWfvvAEEw0xITM7DLR Guc5qgUYV2/bXRVWqpFn6mTIPg9pLitye7QZG2FLagprap987RDWJytgdYbzhtPdsT/+ RPPUVA5QsQFxZiMptRJvQg4WZnOltZ8x0aCRRaeZMAxSm7koUrwrXa8caC1ONHC8+Cx3 wExw== 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:user-agent :in-reply-to:references:mime-version:content-transfer-encoding; bh=/yu8oJIBffJ4JRqiYVpiraykoG8eebIqxgn7sbcB6vI=; b=cqOwPyzPmfiYOUM31QaCiByXTsqhEH6IQktRnykiehgpQTelVvFuel3zfEvjYyUkV5 iP3nhd8XkLB9oxUW+Af3TFl6qnC/lCn+7vSHrlLyVsDEZp7n2fivdH3KE6emHUPGIOz6 SQy3rtjdYs1+Fe8EIICJHNv5QQt3XHiyxho/2Xal/6NgNzXjX7WOLavM+yveZAqoOp4Y 2YBP+AJksqAA5hFmNoIHEH8sZuAwTgvP+8gDeL2FiQp80eHh+s1m4TG5ZbIXg9IZsmsW qZTY9A0IP+T87s3UT+97sHwtyvxNvca+8z6QoD5uiPWQfE97hL/Qekf99/6YjOI21Wwv y1SQ== X-Gm-Message-State: AA6/9RlEPpMrB5emO9KrblGpw7p7nR6wb1Ka2m8yCcHrjAfetbj5YNua4/p8hK5yuMA2n57c X-Received: by 10.194.216.233 with SMTP id ot9mr12677092wjc.166.1475765569134; Thu, 06 Oct 2016 07:52:49 -0700 (PDT) Received: from xps13.localnet (102.202.154.77.rev.sfr.net. [77.154.202.102]) by smtp.gmail.com with ESMTPSA id yo1sm14907478wjc.16.2016.10.06.07.52.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 06 Oct 2016 07:52:48 -0700 (PDT) From: Thomas Monjalon To: Marcin Kerlin Cc: dev@dpdk.org, pablo.de.lara.guarch@intel.com Date: Thu, 06 Oct 2016 16:52:46 +0200 Message-ID: <4741418.sMAp9bqNYx@xps13> User-Agent: KMail/4.14.10 (Linux/4.5.4-1-ARCH; KDE/4.14.11; x86_64; ; ) In-Reply-To: <1475244055-6309-2-git-send-email-marcinx.kerlin@intel.com> References: <1474974783-4861-2-git-send-email-marcinx.kerlin@intel.com> <1475244055-6309-1-git-send-email-marcinx.kerlin@intel.com> <1475244055-6309-2-git-send-email-marcinx.kerlin@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Subject: Re: [dpdk-dev] [PATCH v5 1/2] librte_ether: add protection against overwrite device data 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: Thu, 06 Oct 2016 14:52:49 -0000 2016-09-30 16:00, Marcin Kerlin: > Added protection against overwrite device data in array rte_eth_dev_data[] > for the next secondary applications. Secondary process appends in the > first free place rather than at the beginning. This behavior prevents > overwriting devices data of primary process by secondary process. It would be good to state what is a secondary process. You are trying to extend its capabilities to be able to initialize devices. So primary and secondary processes are almost equivalent? What happens if we do not create any device in the primary? Answer from code review: "Cannot allocate memzone for ethernet port data\n" The secondary process is a hack to me. But it is fine to have such hack for debug or monitoring purpose. I would like to understand what are the other use cases? By the way, the code managing the shared data of a device should be at the EAL level in order to be used by other interfaces like crypto. > @@ -631,6 +692,8 @@ int > rte_eth_dev_detach(uint8_t port_id, char *name) > { > struct rte_pci_addr addr; > + struct rte_eth_dev_data *eth_dev_data = NULL; > + char device[RTE_ETH_NAME_MAX_LEN]; > int ret = -1; > > if (name == NULL) { > @@ -642,6 +705,15 @@ rte_eth_dev_detach(uint8_t port_id, char *name) > if (rte_eth_dev_is_detachable(port_id)) > goto err; > > + /* get device name by port id */ > + if (rte_eth_dev_get_name_by_port(port_id, device)) > + goto err; > + > + /* look for an entry in the shared device data */ > + eth_dev_data = rte_eth_dev_get_dev_data_by_name(device); > + if (eth_dev_data == NULL) > + goto err; Why not getting eth_dev_data from rte_eth_devices[port_id].data ? > --- a/lib/librte_ether/rte_ethdev.h > +++ b/lib/librte_ether/rte_ethdev.h > /** > * @internal > + * Release device data kept in shared memory for all processes. > + * > + * @param port_id > + * The port identifier of the device to release device data. > + * @return > + * - 0 on success, negative on error > + */ > +int rte_eth_dev_release_dev_data(uint8_t port_id); Why this function? It is not used. You already have done the job in the detach function.