pci: separate detaching ethernet ports from PCI devices
Attaching and detaching ethernet ports from an application is not the same thing as physically removing a PCI device, so clarify the flags indicating support. All PCI devices are assumed to be physically removable, so no flag is necessary in the PCI layer. Signed-off-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
parent
e84ad157b7
commit
22dda618c0
@ -106,5 +106,5 @@ Limitations
|
||||
|
||||
* Not all PMDs support detaching feature.
|
||||
To know whether a PMD can support detaching, search for the
|
||||
"RTE_PCI_DRV_DETACHABLE" flag in PMD implementation. If the flag is
|
||||
"RTE_ETH_DEV_DETACHABLE" flag in rte_eth_dev::data::dev_flags. If the flag is
|
||||
defined in the PMD, detaching is supported.
|
||||
|
@ -1057,6 +1057,7 @@ bnxt_dev_init(struct rte_eth_dev *eth_dev)
|
||||
RTE_LOG(INFO, PMD, "%s", bnxt_version);
|
||||
|
||||
rte_eth_copy_pci_info(eth_dev, pci_dev);
|
||||
eth_dev->data->dev_flags = RTE_ETH_DEV_DETACHABLE;
|
||||
bp = eth_dev->data->dev_private;
|
||||
|
||||
if (bnxt_vf_pciid(pci_dev->id.device_id))
|
||||
@ -1168,7 +1169,7 @@ static struct eth_driver bnxt_rte_pmd = {
|
||||
.pci_drv = {
|
||||
.id_table = bnxt_pci_id_map,
|
||||
.drv_flags = RTE_PCI_DRV_NEED_MAPPING |
|
||||
RTE_PCI_DRV_DETACHABLE | RTE_PCI_DRV_INTR_LSC,
|
||||
RTE_PCI_DRV_INTR_LSC,
|
||||
.probe = rte_eth_dev_pci_probe,
|
||||
.remove = rte_eth_dev_pci_remove
|
||||
},
|
||||
|
@ -313,6 +313,7 @@ eth_em_dev_init(struct rte_eth_dev *eth_dev)
|
||||
}
|
||||
|
||||
rte_eth_copy_pci_info(eth_dev, pci_dev);
|
||||
eth_dev->data->dev_flags = RTE_ETH_DEV_DETACHABLE;
|
||||
|
||||
hw->hw_addr = (void *)pci_dev->mem_resource[0].addr;
|
||||
hw->device_id = pci_dev->id.device_id;
|
||||
@ -392,8 +393,7 @@ eth_em_dev_uninit(struct rte_eth_dev *eth_dev)
|
||||
static struct eth_driver rte_em_pmd = {
|
||||
.pci_drv = {
|
||||
.id_table = pci_id_em_map,
|
||||
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
|
||||
RTE_PCI_DRV_DETACHABLE,
|
||||
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
|
||||
.probe = rte_eth_dev_pci_probe,
|
||||
.remove = rte_eth_dev_pci_remove,
|
||||
},
|
||||
|
@ -774,6 +774,7 @@ eth_igb_dev_init(struct rte_eth_dev *eth_dev)
|
||||
}
|
||||
|
||||
rte_eth_copy_pci_info(eth_dev, pci_dev);
|
||||
eth_dev->data->dev_flags = RTE_ETH_DEV_DETACHABLE;
|
||||
|
||||
hw->hw_addr= (void *)pci_dev->mem_resource[0].addr;
|
||||
|
||||
@ -982,6 +983,7 @@ eth_igbvf_dev_init(struct rte_eth_dev *eth_dev)
|
||||
|
||||
pci_dev = E1000_DEV_TO_PCI(eth_dev);
|
||||
rte_eth_copy_pci_info(eth_dev, pci_dev);
|
||||
eth_dev->data->dev_flags = RTE_ETH_DEV_DETACHABLE;
|
||||
|
||||
hw->device_id = pci_dev->id.device_id;
|
||||
hw->vendor_id = pci_dev->id.vendor_id;
|
||||
@ -1085,8 +1087,7 @@ eth_igbvf_dev_uninit(struct rte_eth_dev *eth_dev)
|
||||
static struct eth_driver rte_igb_pmd = {
|
||||
.pci_drv = {
|
||||
.id_table = pci_id_igb_map,
|
||||
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
|
||||
RTE_PCI_DRV_DETACHABLE,
|
||||
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
|
||||
.probe = rte_eth_dev_pci_probe,
|
||||
.remove = rte_eth_dev_pci_remove,
|
||||
},
|
||||
@ -1101,7 +1102,7 @@ static struct eth_driver rte_igb_pmd = {
|
||||
static struct eth_driver rte_igbvf_pmd = {
|
||||
.pci_drv = {
|
||||
.id_table = pci_id_igbvf_map,
|
||||
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_DETACHABLE,
|
||||
.drv_flags = RTE_PCI_DRV_NEED_MAPPING,
|
||||
.probe = rte_eth_dev_pci_probe,
|
||||
.remove = rte_eth_dev_pci_remove,
|
||||
},
|
||||
|
@ -2858,6 +2858,7 @@ eth_fm10k_dev_init(struct rte_eth_dev *dev)
|
||||
return 0;
|
||||
|
||||
rte_eth_copy_pci_info(dev, pdev);
|
||||
dev->data->dev_flags = RTE_ETH_DEV_DETACHABLE;
|
||||
|
||||
macvlan = FM10K_DEV_PRIVATE_TO_MACVLAN(dev->data->dev_private);
|
||||
memset(macvlan, 0, sizeof(*macvlan));
|
||||
@ -3080,8 +3081,7 @@ static const struct rte_pci_id pci_id_fm10k_map[] = {
|
||||
static struct eth_driver rte_pmd_fm10k = {
|
||||
.pci_drv = {
|
||||
.id_table = pci_id_fm10k_map,
|
||||
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
|
||||
RTE_PCI_DRV_DETACHABLE,
|
||||
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
|
||||
.probe = rte_eth_dev_pci_probe,
|
||||
.remove = rte_eth_dev_pci_remove,
|
||||
},
|
||||
|
@ -671,8 +671,7 @@ static const struct rte_i40e_xstats_name_off rte_i40e_txq_prio_strings[] = {
|
||||
static struct eth_driver rte_i40e_pmd = {
|
||||
.pci_drv = {
|
||||
.id_table = pci_id_i40e_map,
|
||||
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
|
||||
RTE_PCI_DRV_DETACHABLE,
|
||||
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
|
||||
.probe = rte_eth_dev_pci_probe,
|
||||
.remove = rte_eth_dev_pci_remove,
|
||||
},
|
||||
@ -959,6 +958,7 @@ eth_i40e_dev_init(struct rte_eth_dev *dev)
|
||||
intr_handle = &pci_dev->intr_handle;
|
||||
|
||||
rte_eth_copy_pci_info(dev, pci_dev);
|
||||
dev->data->dev_flags = RTE_ETH_DEV_DETACHABLE;
|
||||
|
||||
pf->adapter = I40E_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
|
||||
pf->adapter->eth_dev = dev;
|
||||
|
@ -1460,6 +1460,7 @@ i40evf_dev_init(struct rte_eth_dev *eth_dev)
|
||||
}
|
||||
|
||||
rte_eth_copy_pci_info(eth_dev, pci_dev);
|
||||
eth_dev->data->dev_flags = RTE_ETH_DEV_DETACHABLE;
|
||||
|
||||
hw->vendor_id = pci_dev->id.vendor_id;
|
||||
hw->device_id = pci_dev->id.device_id;
|
||||
@ -1529,7 +1530,7 @@ i40evf_dev_uninit(struct rte_eth_dev *eth_dev)
|
||||
static struct eth_driver rte_i40evf_pmd = {
|
||||
.pci_drv = {
|
||||
.id_table = pci_id_i40evf_map,
|
||||
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_DETACHABLE,
|
||||
.drv_flags = RTE_PCI_DRV_NEED_MAPPING,
|
||||
.probe = rte_eth_dev_pci_probe,
|
||||
.remove = rte_eth_dev_pci_remove,
|
||||
},
|
||||
|
@ -1134,6 +1134,7 @@ eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev)
|
||||
}
|
||||
|
||||
rte_eth_copy_pci_info(eth_dev, pci_dev);
|
||||
eth_dev->data->dev_flags = RTE_ETH_DEV_DETACHABLE;
|
||||
|
||||
/* Vendor and Device ID need to be set before init of shared code */
|
||||
hw->device_id = pci_dev->id.device_id;
|
||||
@ -1424,6 +1425,7 @@ eth_ixgbevf_dev_init(struct rte_eth_dev *eth_dev)
|
||||
}
|
||||
|
||||
rte_eth_copy_pci_info(eth_dev, pci_dev);
|
||||
eth_dev->data->dev_flags = RTE_ETH_DEV_DETACHABLE;
|
||||
|
||||
hw->device_id = pci_dev->id.device_id;
|
||||
hw->vendor_id = pci_dev->id.vendor_id;
|
||||
@ -1566,8 +1568,7 @@ eth_ixgbevf_dev_uninit(struct rte_eth_dev *eth_dev)
|
||||
static struct eth_driver rte_ixgbe_pmd = {
|
||||
.pci_drv = {
|
||||
.id_table = pci_id_ixgbe_map,
|
||||
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
|
||||
RTE_PCI_DRV_DETACHABLE,
|
||||
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
|
||||
.probe = rte_eth_dev_pci_probe,
|
||||
.remove = rte_eth_dev_pci_remove,
|
||||
},
|
||||
@ -1582,7 +1583,7 @@ static struct eth_driver rte_ixgbe_pmd = {
|
||||
static struct eth_driver rte_ixgbevf_pmd = {
|
||||
.pci_drv = {
|
||||
.id_table = pci_id_ixgbevf_map,
|
||||
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_DETACHABLE,
|
||||
.drv_flags = RTE_PCI_DRV_NEED_MAPPING,
|
||||
.probe = rte_eth_dev_pci_probe,
|
||||
.remove = rte_eth_dev_pci_remove,
|
||||
},
|
||||
|
@ -2338,6 +2338,7 @@ nfp_net_init(struct rte_eth_dev *eth_dev)
|
||||
|
||||
pci_dev = RTE_DEV_TO_PCI(eth_dev->device);
|
||||
rte_eth_copy_pci_info(eth_dev, pci_dev);
|
||||
eth_dev->data->dev_flags = RTE_ETH_DEV_DETACHABLE;
|
||||
|
||||
hw->device_id = pci_dev->id.device_id;
|
||||
hw->vendor_id = pci_dev->id.vendor_id;
|
||||
@ -2475,8 +2476,7 @@ static struct rte_pci_id pci_id_nfp_net_map[] = {
|
||||
static struct eth_driver rte_nfp_net_pmd = {
|
||||
.pci_drv = {
|
||||
.id_table = pci_id_nfp_net_map,
|
||||
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
|
||||
RTE_PCI_DRV_DETACHABLE,
|
||||
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
|
||||
.probe = rte_eth_dev_pci_probe,
|
||||
.remove = rte_eth_dev_pci_remove,
|
||||
},
|
||||
|
@ -1212,8 +1212,10 @@ virtio_init_device(struct rte_eth_dev *eth_dev, uint64_t req_features)
|
||||
else
|
||||
eth_dev->data->dev_flags |= RTE_ETH_DEV_INTR_LSC;
|
||||
|
||||
if (pci_dev)
|
||||
if (pci_dev) {
|
||||
rte_eth_copy_pci_info(eth_dev, pci_dev);
|
||||
eth_dev->data->dev_flags = RTE_ETH_DEV_DETACHABLE;
|
||||
}
|
||||
|
||||
rx_func_get(eth_dev);
|
||||
|
||||
@ -1383,7 +1385,7 @@ static struct eth_driver rte_virtio_pmd = {
|
||||
.name = "net_virtio",
|
||||
},
|
||||
.id_table = pci_id_virtio_map,
|
||||
.drv_flags = RTE_PCI_DRV_DETACHABLE,
|
||||
.drv_flags = 0,
|
||||
.probe = rte_eth_dev_pci_probe,
|
||||
.remove = rte_eth_dev_pci_remove,
|
||||
},
|
||||
|
@ -250,6 +250,7 @@ eth_vmxnet3_dev_init(struct rte_eth_dev *eth_dev)
|
||||
return 0;
|
||||
|
||||
rte_eth_copy_pci_info(eth_dev, pci_dev);
|
||||
eth_dev->data->dev_flags = RTE_ETH_DEV_DETACHABLE;
|
||||
|
||||
/* Vendor and Device ID need to be set before init of shared code */
|
||||
hw->device_id = pci_dev->id.device_id;
|
||||
@ -340,7 +341,7 @@ eth_vmxnet3_dev_uninit(struct rte_eth_dev *eth_dev)
|
||||
static struct eth_driver rte_vmxnet3_pmd = {
|
||||
.pci_drv = {
|
||||
.id_table = pci_id_vmxnet3_map,
|
||||
.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_DETACHABLE,
|
||||
.drv_flags = RTE_PCI_DRV_NEED_MAPPING,
|
||||
.probe = rte_eth_dev_pci_probe,
|
||||
.remove = rte_eth_dev_pci_remove,
|
||||
},
|
||||
|
@ -672,7 +672,7 @@ eth_dev_xenvirt_create(const char *name, const char *params,
|
||||
eth_dev->data = data;
|
||||
eth_dev->dev_ops = &ops;
|
||||
|
||||
eth_dev->data->dev_flags = RTE_PCI_DRV_DETACHABLE;
|
||||
eth_dev->data->dev_flags = RTE_ETH_DEV_DETACHABLE;
|
||||
eth_dev->data->kdrv = RTE_KDRV_NONE;
|
||||
eth_dev->data->drv_name = drivername;
|
||||
eth_dev->driver = NULL;
|
||||
|
@ -216,8 +216,6 @@ struct rte_pci_driver {
|
||||
#define RTE_PCI_DRV_NEED_MAPPING 0x0001
|
||||
/** Device driver supports link state interrupt */
|
||||
#define RTE_PCI_DRV_INTR_LSC 0x0008
|
||||
/** Device driver supports detaching capability */
|
||||
#define RTE_PCI_DRV_DETACHABLE 0x0010
|
||||
|
||||
/**
|
||||
* A structure describing a PCI mapping.
|
||||
|
@ -3272,8 +3272,6 @@ rte_eth_copy_pci_info(struct rte_eth_dev *eth_dev, struct rte_pci_device *pci_de
|
||||
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_DETACHABLE)
|
||||
eth_dev->data->dev_flags |= RTE_ETH_DEV_DETACHABLE;
|
||||
|
||||
eth_dev->data->kdrv = pci_dev->kdrv;
|
||||
eth_dev->data->numa_node = pci_dev->device.numa_node;
|
||||
|
Loading…
Reference in New Issue
Block a user