pci: merge mapping structures for linux and bsd

This patch consolidates below structures, and defines them in common code.
 - struct pci_map
 - struct mapped_pci_resources

Signed-off-by: Tetsuya Mukawa <mukawa@igel.co.jp>
Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>
Acked-by: David Marchand <david.marchand@6wind.com>
This commit is contained in:
Tetsuya Mukawa 2015-07-08 19:34:49 +09:00 committed by Thomas Monjalon
parent ea9d56226e
commit 0801f9fc5b
3 changed files with 28 additions and 47 deletions

View File

@ -82,30 +82,6 @@
* network card, only providing access to PCI BAR to applications, and
* enabling bus master.
*/
struct pci_map {
void *addr;
char *path;
uint64_t offset;
uint64_t size;
uint64_t phaddr;
};
/*
* For multi-process we need to reproduce all PCI mappings in secondary
* processes, so save them in a tailq.
*/
struct mapped_pci_resource {
TAILQ_ENTRY(mapped_pci_resource) next;
struct rte_pci_addr pci_addr;
char path[PATH_MAX];
int nb_maps;
struct pci_map maps[PCI_MAX_RESOURCE];
};
TAILQ_HEAD(mapped_pci_res_list, mapped_pci_resource);
static struct rte_tailq_elem rte_uio_tailq = {
.name = "UIO_RESOURCE_LIST",
};

View File

@ -220,6 +220,34 @@ struct rte_pci_driver {
/** Device driver supports detaching capability */
#define RTE_PCI_DRV_DETACHABLE 0x0010
/**
* A structure describing a PCI mapping.
*/
struct pci_map {
void *addr;
char *path;
uint64_t offset;
uint64_t size;
uint64_t phaddr;
};
/**
* A structure describing a mapped PCI resource.
* For multi-process we need to reproduce all PCI mappings in secondary
* processes, so save them in a tailq.
*/
struct mapped_pci_resource {
TAILQ_ENTRY(mapped_pci_resource) next;
struct rte_pci_addr pci_addr;
char path[PATH_MAX];
int nb_maps;
struct pci_map maps[PCI_MAX_RESOURCE];
};
/** mapped pci device list */
TAILQ_HEAD(mapped_pci_res_list, mapped_pci_resource);
/**< Internal use only - Macro used by pci addr parsing functions **/
#define GET_PCIADDR_FIELD(in, fd, lim, dlm) \
do { \

View File

@ -36,29 +36,6 @@
#include "eal_vfio.h"
struct pci_map {
void *addr;
char *path;
uint64_t offset;
uint64_t size;
uint64_t phaddr;
};
/*
* For multi-process we need to reproduce all PCI mappings in secondary
* processes, so save them in a tailq.
*/
struct mapped_pci_resource {
TAILQ_ENTRY(mapped_pci_resource) next;
struct rte_pci_addr pci_addr;
char path[PATH_MAX];
int nb_maps;
struct pci_map maps[PCI_MAX_RESOURCE];
};
TAILQ_HEAD(mapped_pci_res_list, mapped_pci_resource);
/*
* Helper function to map PCI resources right after hugepages in virtual memory
*/