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 CD3C5A04F0; Mon, 13 Jan 2020 06:03:31 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 9CB3B1D53B; Mon, 13 Jan 2020 06:03:31 +0100 (CET) Received: from m176115.mail.qiye.163.com (m176115.mail.qiye.163.com [59.111.176.115]) by dpdk.org (Postfix) with ESMTP id B804B1D536; Mon, 13 Jan 2020 06:03:29 +0100 (CET) Received: from localhost.localdomain (unknown [113.87.163.18]) by m176115.mail.qiye.163.com (Hmail) with ESMTPA id AE778663146; Mon, 13 Jan 2020 13:03:24 +0800 (CST) From: Fang TongHao To: thomas@monjalon.net, ferruh.yigit@intel.com, arybchenko@solarflare.com Cc: dev@dpdk.org, stable@dpdk.org, jia.guo@intel.com, cunming.liang@intel.com, qi.z.zhang@intel.com, jungle845943968@outlook.com, Fang TongHao Date: Mon, 13 Jan 2020 13:03:12 +0800 Message-Id: <20200113050312.1506-1-fangtonghao@sangfor.com.cn> X-Mailer: git-send-email 2.24.1.windows.2 In-Reply-To: <20200109122710.1362-1-fangtonghao@sangfor.com.cn> References: <20200109122710.1362-1-fangtonghao@sangfor.com.cn> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-HM-Spam-Status: e1kfGhgUHx5ZQUtXWQgYFAkeWUFZSVVKSEtLS0tKSk9PT0tCSVlXWShZQU hPN1dZLVlBSVdZCQ4XHghZQVk1NCk2OjckKS43PlkG X-HM-Sender-Digest: e1kMHhlZQR0aFwgeV1kSHx4VD1lBWUc6Mwg6PTo6CTg2VhxPNiEyESkO VjcaCh9VSlVKTkxDQ0JKQ0tMTE1CVTMWGhIXVR0aFRwPFBUcExoUOwgaFRwdFAlVGBQWVRgVRVlX WRILWUFZSkpIVUNMVUpNSFVKQ1lXWQgBWUFIS0xCNwY+ X-HM-Tid: 0a6f9d4901909373kuwsae778663146 Subject: [dpdk-dev] [PATCH v2] Fixes: ethdev: secondary process change shared memory 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" Secondary process calls “rte_eth_dev_pci_allocate” function and enters rte_eth_copy_pci_info function when initializing.Then it sets the value of struct "rte_eth_dev_data.dev_flags" to zero and reset it, but this struct is shared by primary process and secondary process.To fix this bug,by adding an if-statement to forbid the secondaryprocess changing the above-mentioned value. Signed-off-by: Fang TongHao --- lib/librte_ethdev/rte_ethdev_pci.h | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/lib/librte_ethdev/rte_ethdev_pci.h b/lib/librte_ethdev/rte_ethdev_pci.h index ccdbb46ec..e7dae0545 100644 --- a/lib/librte_ethdev/rte_ethdev_pci.h +++ b/lib/librte_ethdev/rte_ethdev_pci.h @@ -60,14 +60,16 @@ rte_eth_copy_pci_info(struct rte_eth_dev *eth_dev, eth_dev->intr_handle = &pci_dev->intr_handle; - eth_dev->data->dev_flags = 0; - if (pci_dev->driver->drv_flags & RTE_PCI_DRV_INTR_LSC) - eth_dev->data->dev_flags |= RTE_ETH_DEV_INTR_LSC; - if (pci_dev->driver->drv_flags & RTE_PCI_DRV_INTR_RMV) - eth_dev->data->dev_flags |= RTE_ETH_DEV_INTR_RMV; - - eth_dev->data->kdrv = pci_dev->kdrv; - eth_dev->data->numa_node = pci_dev->device.numa_node; + if (rte_eal_process_type() == RTE_PROC_PRIMARY) { + eth_dev->data->dev_flags = 0; + if (pci_dev->driver->drv_flags & RTE_PCI_DRV_INTR_LSC) + eth_dev->data->dev_flags |= RTE_ETH_DEV_INTR_LSC; + if (pci_dev->driver->drv_flags & RTE_PCI_DRV_INTR_RMV) + eth_dev->data->dev_flags |= RTE_ETH_DEV_INTR_RMV; + + eth_dev->data->kdrv = pci_dev->kdrv; + eth_dev->data->numa_node = pci_dev->device.numa_node; + } } static inline int -- 2.24.1.windows.2