From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-f173.google.com (mail-wr0-f173.google.com [209.85.128.173]) by dpdk.org (Postfix) with ESMTP id E0E947CFC for ; Fri, 25 Aug 2017 09:32:41 +0200 (CEST) Received: by mail-wr0-f173.google.com with SMTP id k46so472417wre.0 for ; Fri, 25 Aug 2017 00:32:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=H4bR3JMa9O3VK470DmHtolfg9mdO4YxMxJxQGoAtje0=; b=Co2St6+eSj9/rF86O0Y1KiE+fvg6iUHf8YEgD1g0122lVCHcJnvQXroDdimWl4lZab 1WISyJmpd2gCaiwZh/qR/xAH2AkoZs63bR+AHS8ZkGpqpH5BMwTwAvCISpeVx+efz9DU ql2FzBhfNTm+84t4y9SqMpkWk0FyhdEL5rpU1Oi8bqk2Ua5e3Q+BtbV5fx7wTD7ZN3AQ 0s1wDaSQM+QJ2RNtaZFKiLn9PR65q7ab3/MCRcquCrEOKSk243DtD++X/P8zk89KcuiF oJL3GY4oyfRjQM+W8zoSph/bIvRxzrAtym74RmSC6ZDLJ1vSB+P07q0lvTV4Xa6U7F1P RKiA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=H4bR3JMa9O3VK470DmHtolfg9mdO4YxMxJxQGoAtje0=; b=F2OFWyhxO/VAS6bIsBDsQSVG/bQMcKPOhxrFKZdX/8AETmWieYa0gErBvmark8dgSn qjC8Ymo0opitdSCcjWRtheGqHI5nV+Yw6AzXYkUo3MCV0OF7l9dbWg9P9/rT+NYfVYZ1 5Gp5dO4cqKKOzDeYY9uf59xuSzVOGMMtPWkKpKow51ybPsH4453WtI3e0v8s2FMHKKC5 ZfTN/ns0cS9ypZZYZC986Z9yTUwd44JV41OpFMU3arHhCi1Vle4jFPdZ2BczMMb8rwGM +A/GFlfsFIJwDu3Ycl/GPsgL+k3ULvk52q3xrnGc69u/M0+BWyHeq/Br+PIDD8Zeyoir nMag== X-Gm-Message-State: AHYfb5gUp6ecjmxTjNM3YqrRWyOrkKpJEnggqLOEpVlDW2IDDF/iFbrh cE5kQ7893Qp7Gb0d X-Received: by 10.223.170.12 with SMTP id p12mr5930554wrd.238.1503646361514; Fri, 25 Aug 2017 00:32:41 -0700 (PDT) Received: from autoinstall.dev.6wind.com (host.78.145.23.62.rev.coltfrance.com. [62.23.145.78]) by smtp.gmail.com with ESMTPSA id r135sm1114051wmg.18.2017.08.25.00.32.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 25 Aug 2017 00:32:40 -0700 (PDT) Date: Fri, 25 Aug 2017 09:32:31 +0200 From: =?iso-8859-1?Q?N=E9lio?= Laranjeiro To: "Xueming(Steven) Li" Cc: "dev@dpdk.org" Message-ID: <20170825073231.GT4544@autoinstall.dev.6wind.com> References: <20170824140341.95471-1-xuemingl@mellanox.com> <20170825065213.GR4544@autoinstall.dev.6wind.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) Subject: Re: [dpdk-dev] [PATCH v1 1/2] net/mlx5: change eth device reference for secondary process 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: , X-List-Received-Date: Fri, 25 Aug 2017 07:32:42 -0000 On Fri, Aug 25, 2017 at 07:15:50AM +0000, Xueming(Steven) Li wrote: > Nelio, thanks, comments inline. >[...] > > > static int > > > -priv_set_link(struct priv *priv, int up) > > > +mlx5_dev_set_link(struct rte_eth_dev *dev, int up) > > > { > > > - struct rte_eth_dev *dev = priv->dev; > > > + struct priv *priv = dev->data->dev_private; > > > int err; > > > > > > > This function should lock/unclock priv. > This is a static function, caller function do the lock/unlock. > Is there naming convention here? Mlx5_* is outpost interfaces that normally > require lock/unlock priv? Yes there is a naming convention following the patterns: - priv_...(struct *priv priv, ...): no locks inside. - priv_dev_...(struct *priv priv, struct rte_eth_dev *dev, ...): no locks inside. - mlx5_...(struct rte_eth_dev *dev, ...): should lock any access to struct priv and to priv_*(). > > > if (up) { > > > err = priv_set_flags(priv, ~IFF_UP, IFF_UP); > > > if (err) > > > return err; > > > - priv_select_tx_function(priv); > > > - priv_select_rx_function(priv); > > > + mlx5_dev_select_tx_function(dev); > > > + mlx5_dev_select_rx_function(dev); > > > > This also induce that those function mlx5_dev_select_rx/tx_function() should > > be renamed to: > > priv_dev_select_rx/tx_function(struct *priv, struct rte_eth_dev *dev, ...) > > > > this will avoid the multiple lock/unlocks inside the functions. > So priv_* are lock-free functions? priv_*() assume the lock have been done by the caller. Hope it helps. Thanks, -- Nélio Laranjeiro 6WIND