X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=lib%2Flibrte_ethdev%2Frte_ethdev_pci.h;h=a999602fddd5c0fb191fed019cc866a7ba4306ac;hb=08ab4769c2b868143536ea3d1807e9a25647fd9e;hp=ccdbb46ec03c24038d6c7ce9d7b70731c8239203;hpb=ca5ba1b6972f381d410f9e53b650ba179e776225;p=dpdk.git diff --git a/lib/librte_ethdev/rte_ethdev_pci.h b/lib/librte_ethdev/rte_ethdev_pci.h index ccdbb46ec0..a999602fdd 100644 --- a/lib/librte_ethdev/rte_ethdev_pci.h +++ b/lib/librte_ethdev/rte_ethdev_pci.h @@ -1,7 +1,5 @@ -/*- - * BSD LICENSE - * - * Copyright(c) 2017 Brocade Communications Systems, Inc. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2017 Brocade Communications Systems, Inc. * Author: Jan Blunck * * Redistribution and use in source and binary forms, with or without @@ -42,6 +40,8 @@ /** * Copy pci device info to the Ethernet device data. + * Shared memory (eth_dev->data) only updated by primary process, so it is safe + * to call this function from both primary and secondary processes. * * @param eth_dev * The *eth_dev* pointer is the address of the *rte_eth_dev* structure. @@ -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