From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by dpdk.org (Postfix) with ESMTP id 5D46423B; Mon, 18 Sep 2017 23:27:24 +0200 (CEST) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga105.jf.intel.com with ESMTP; 18 Sep 2017 14:27:23 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.42,414,1500966000"; d="scan'208";a="901489531" Received: from fyigit-mobl1.ger.corp.intel.com (HELO [10.237.220.57]) ([10.237.220.57]) by FMSMGA003.fm.intel.com with ESMTP; 18 Sep 2017 14:27:16 -0700 To: John Daley Cc: dev@dpdk.org, stable@dpdk.org, Sergio Gonzalez Monroy , Thomas Monjalon References: <20170911185833.11458-1-johndale@cisco.com> From: Ferruh Yigit Message-ID: <488ca130-7a8e-223f-5b9e-50bdab9b93f2@intel.com> Date: Mon, 18 Sep 2017 22:27:15 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: <20170911185833.11458-1-johndale@cisco.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Subject: Re: [dpdk-dev] [PATCH] net/enic: fix multi-process operation 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: Mon, 18 Sep 2017 21:27:24 -0000 On 9/11/2017 7:58 PM, John Daley wrote: > - Use rte_malloc() instead of malloc() for the per device 'vdev' structure > so that it can be shared across processes. > - Only initialize the device if the process type is RTE_PROC_PRIMARY > - Only allow the primary process to do queue setup, start/stop, promisc > allmulticast, mac add/del, mtu. > > Fixes: fefed3d1e62c ("enic: new driver") > Cc: stable@dpdk.org > > Signed-off-by: John Daley <...> > diff --git a/drivers/net/enic/enic_ethdev.c b/drivers/net/enic/enic_ethdev.c > index da8fec2d0..33a3f87e2 100644 > --- a/drivers/net/enic/enic_ethdev.c > +++ b/drivers/net/enic/enic_ethdev.c > @@ -142,6 +142,10 @@ enicpmd_dev_filter_ctrl(struct rte_eth_dev *dev, > static void enicpmd_dev_tx_queue_release(void *txq) > { > ENICPMD_FUNC_TRACE(); > + > + if (rte_eal_process_type() != RTE_PROC_PRIMARY) > + return; > + Hi John, I am not sure about these updates. Agree that these functions should know process type, but all others PMDs don't do this. Added a few more people for comment, but as far I understand its application responsibility to NOT call these functions if it is secondary process. For device init/uninit, that is part of eal_init() and have to be called both for primary and secondary process and PMD needs to protect it, for other functions application's responsibility. > enic_free_wq(txq); > } > > @@ -196,6 +200,9 @@ static int enicpmd_dev_tx_queue_setup(struct rte_eth_dev *eth_dev, > int ret; > struct enic *enic = pmd_priv(eth_dev); > > + if (rte_eal_process_type() != RTE_PROC_PRIMARY) > + return -E_RTE_SECONDARY; > + > ENICPMD_FUNC_TRACE(); > if (queue_idx >= ENIC_WQ_MAX) { > dev_err(enic, > @@ -272,6 +279,10 @@ static int enicpmd_dev_rx_queue_stop(struct rte_eth_dev *eth_dev, > static void enicpmd_dev_rx_queue_release(void *rxq) > { > ENICPMD_FUNC_TRACE(); > + > + if (rte_eal_process_type() != RTE_PROC_PRIMARY) > + return; > + > enic_free_rq(rxq); > } > <...>