[dpdk-dev] [PATCH v9 08/12] eal: Consolidate pci_map and mapped_pci_resource of linuxapp and bsdapp
Tetsuya Mukawa
mukawa at igel.co.jp
Wed Jul 8 12:34:49 CEST 2015
From: "Tetsuya.Mukawa" <mukawa at igel.co.jp>
This patch consolidates below structures, and defines them in common code.
- struct pci_map
- strucy mapped_pci_resouces
Signed-off-by: Tetsuya Mukawa <mukawa at igel.co.jp>
Acked-by: Bernard Iremonger <bernard.iremonger at intel.com>
Acked-by: David Marchand <david.marchand at 6wind.com>
---
lib/librte_eal/bsdapp/eal/eal_pci.c | 24 ------------------------
lib/librte_eal/common/include/rte_pci.h | 29 +++++++++++++++++++++++++++++
lib/librte_eal/linuxapp/eal/eal_pci_init.h | 23 -----------------------
3 files changed, 29 insertions(+), 47 deletions(-)
diff --git a/lib/librte_eal/bsdapp/eal/eal_pci.c b/lib/librte_eal/bsdapp/eal/eal_pci.c
index 1dfcb82..83c8d0c 100644
--- a/lib/librte_eal/bsdapp/eal/eal_pci.c
+++ b/lib/librte_eal/bsdapp/eal/eal_pci.c
@@ -83,30 +83,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",
};
diff --git a/lib/librte_eal/common/include/rte_pci.h b/lib/librte_eal/common/include/rte_pci.h
index 7801fa0..d95747e 100644
--- a/lib/librte_eal/common/include/rte_pci.h
+++ b/lib/librte_eal/common/include/rte_pci.h
@@ -2,6 +2,7 @@
* BSD LICENSE
*
* Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+ * Copyright(c) 2015 IGEL Co., Ltd.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -220,6 +221,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 { \
diff --git a/lib/librte_eal/linuxapp/eal/eal_pci_init.h b/lib/librte_eal/linuxapp/eal/eal_pci_init.h
index aa7b755..d9d1878 100644
--- a/lib/librte_eal/linuxapp/eal/eal_pci_init.h
+++ b/lib/librte_eal/linuxapp/eal/eal_pci_init.h
@@ -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
*/
--
2.1.4
More information about the dev
mailing list