pci: export device mapping functions
Normally we could set RTE_PCI_DRV_NEED_MAPPING flag so that eal will invoke pci_map_device internally for us. From that point view, there is no need to export pci_map_device. However, for virtio pmd driver, which is designed to work without binding UIO (or something similar first), pci_map_device() will fail, which ends up with virtio pmd driver being skipped. Therefore, we can not set RTE_PCI_DRV_NEED_MAPPING blindly at virtio pmd driver. Therefore, this patch exports pci_map_device, and let virtio pmd call it when necessary. Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com> Tested-by: Santosh Shukla <sshukla@mvista.com> Tested-by: Qian Xu <qian.q.xu@intel.com> Reviewed-by: Tetsuya Mukawa <mukawa@igel.co.jp> Tested-by: Tetsuya Mukawa <mukawa@igel.co.jp> Acked-by: David Marchand <david.marchand@6wind.com> Acked-by: Huawei Xie <huawei.xie@intel.com>
This commit is contained in:
parent
1905e101dc
commit
962cf902e6
@ -93,7 +93,7 @@ pci_unbind_kernel_driver(struct rte_pci_device *dev __rte_unused)
|
|||||||
|
|
||||||
/* Map pci device */
|
/* Map pci device */
|
||||||
int
|
int
|
||||||
pci_map_device(struct rte_pci_device *dev)
|
rte_eal_pci_map_device(struct rte_pci_device *dev)
|
||||||
{
|
{
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
|
|
||||||
@ -115,7 +115,7 @@ pci_map_device(struct rte_pci_device *dev)
|
|||||||
|
|
||||||
/* Unmap pci device */
|
/* Unmap pci device */
|
||||||
void
|
void
|
||||||
pci_unmap_device(struct rte_pci_device *dev)
|
rte_eal_pci_unmap_device(struct rte_pci_device *dev)
|
||||||
{
|
{
|
||||||
/* try unmapping the NIC resources */
|
/* try unmapping the NIC resources */
|
||||||
switch (dev->kdrv) {
|
switch (dev->kdrv) {
|
||||||
|
@ -139,6 +139,8 @@ DPDK_2.2 {
|
|||||||
DPDK_2.3 {
|
DPDK_2.3 {
|
||||||
global:
|
global:
|
||||||
|
|
||||||
|
rte_eal_pci_map_device;
|
||||||
|
rte_eal_pci_unmap_device;
|
||||||
rte_cpu_feature_table;
|
rte_cpu_feature_table;
|
||||||
|
|
||||||
} DPDK_2.2;
|
} DPDK_2.2;
|
||||||
|
@ -188,7 +188,7 @@ rte_eal_pci_probe_one_driver(struct rte_pci_driver *dr, struct rte_pci_device *d
|
|||||||
pci_config_space_set(dev);
|
pci_config_space_set(dev);
|
||||||
#endif
|
#endif
|
||||||
/* map resources for devices that use igb_uio */
|
/* map resources for devices that use igb_uio */
|
||||||
ret = pci_map_device(dev);
|
ret = rte_eal_pci_map_device(dev);
|
||||||
if (ret != 0)
|
if (ret != 0)
|
||||||
return ret;
|
return ret;
|
||||||
} else if (dr->drv_flags & RTE_PCI_DRV_FORCE_UNBIND &&
|
} else if (dr->drv_flags & RTE_PCI_DRV_FORCE_UNBIND &&
|
||||||
@ -254,7 +254,7 @@ rte_eal_pci_detach_dev(struct rte_pci_driver *dr,
|
|||||||
|
|
||||||
if (dr->drv_flags & RTE_PCI_DRV_NEED_MAPPING)
|
if (dr->drv_flags & RTE_PCI_DRV_NEED_MAPPING)
|
||||||
/* unmap resources for devices that use igb_uio */
|
/* unmap resources for devices that use igb_uio */
|
||||||
pci_unmap_device(dev);
|
rte_eal_pci_unmap_device(dev);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -164,24 +164,6 @@ struct rte_pci_device;
|
|||||||
*/
|
*/
|
||||||
int pci_unbind_kernel_driver(struct rte_pci_device *dev);
|
int pci_unbind_kernel_driver(struct rte_pci_device *dev);
|
||||||
|
|
||||||
/**
|
|
||||||
* Map this device
|
|
||||||
*
|
|
||||||
* This function is private to EAL.
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
* 0 on success, negative on error and positive if no driver
|
|
||||||
* is found for the device.
|
|
||||||
*/
|
|
||||||
int pci_map_device(struct rte_pci_device *dev);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Unmap this device
|
|
||||||
*
|
|
||||||
* This function is private to EAL.
|
|
||||||
*/
|
|
||||||
void pci_unmap_device(struct rte_pci_device *dev);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Map the PCI resource of a PCI device in virtual memory
|
* Map the PCI resource of a PCI device in virtual memory
|
||||||
*
|
*
|
||||||
|
@ -366,6 +366,32 @@ int rte_eal_pci_scan(void);
|
|||||||
*/
|
*/
|
||||||
int rte_eal_pci_probe(void);
|
int rte_eal_pci_probe(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Map the PCI device resources in user space virtual memory address
|
||||||
|
*
|
||||||
|
* Note that driver should not call this function when flag
|
||||||
|
* RTE_PCI_DRV_NEED_MAPPING is set, as EAL will do that for
|
||||||
|
* you when it's on.
|
||||||
|
*
|
||||||
|
* @param dev
|
||||||
|
* A pointer to a rte_pci_device structure describing the device
|
||||||
|
* to use
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
* 0 on success, negative on error and positive if no driver
|
||||||
|
* is found for the device.
|
||||||
|
*/
|
||||||
|
int rte_eal_pci_map_device(struct rte_pci_device *dev);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unmap this device
|
||||||
|
*
|
||||||
|
* @param dev
|
||||||
|
* A pointer to a rte_pci_device structure describing the device
|
||||||
|
* to use
|
||||||
|
*/
|
||||||
|
void rte_eal_pci_unmap_device(struct rte_pci_device *dev);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @internal
|
* @internal
|
||||||
* Map a particular resource from a file.
|
* Map a particular resource from a file.
|
||||||
|
@ -124,7 +124,7 @@ pci_get_kernel_driver_by_path(const char *filename, char *dri_name)
|
|||||||
|
|
||||||
/* Map pci device */
|
/* Map pci device */
|
||||||
int
|
int
|
||||||
pci_map_device(struct rte_pci_device *dev)
|
rte_eal_pci_map_device(struct rte_pci_device *dev)
|
||||||
{
|
{
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
|
|
||||||
@ -153,7 +153,7 @@ pci_map_device(struct rte_pci_device *dev)
|
|||||||
|
|
||||||
/* Unmap pci device */
|
/* Unmap pci device */
|
||||||
void
|
void
|
||||||
pci_unmap_device(struct rte_pci_device *dev)
|
rte_eal_pci_unmap_device(struct rte_pci_device *dev)
|
||||||
{
|
{
|
||||||
/* try unmapping the NIC resources using VFIO if it exists */
|
/* try unmapping the NIC resources using VFIO if it exists */
|
||||||
switch (dev->kdrv) {
|
switch (dev->kdrv) {
|
||||||
|
@ -142,5 +142,8 @@ DPDK_2.2 {
|
|||||||
DPDK_2.3 {
|
DPDK_2.3 {
|
||||||
global:
|
global:
|
||||||
|
|
||||||
|
rte_eal_pci_map_device;
|
||||||
|
rte_eal_pci_unmap_device;
|
||||||
rte_cpu_feature_table;
|
rte_cpu_feature_table;
|
||||||
|
|
||||||
} DPDK_2.2;
|
} DPDK_2.2;
|
||||||
|
Loading…
Reference in New Issue
Block a user