From: Bernard Iremonger <bernard.iremonger@intel.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH v8 01/11] librte_ether: add fields from rte_pci_driver to rte_eth_dev_data
Date: Tue, 3 Nov 2015 13:01:55 +0000 [thread overview]
Message-ID: <1446555725-19540-2-git-send-email-bernard.iremonger@intel.com> (raw)
In-Reply-To: <1446555725-19540-1-git-send-email-bernard.iremonger@intel.com>
The driver fields have been added the rte_eth_dev_data so that it is no
longer necessary access this data through the pci_dev pointer.
The following fields have been added to rte_eth_dev_data:
dev_flags, and macros for dev_flags.
kdrv
numa_node
drv_name
add function rte_eth_copy_pci_info
remove branches on pci_dev
librte_eal: add RTE_KDRV_NONE for vdevs
Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
---
lib/librte_eal/common/include/rte_pci.h | 3 ++-
lib/librte_ether/rte_ethdev.c | 24 ++++++++++++++++++++++++
lib/librte_ether/rte_ethdev.h | 27 +++++++++++++++++++++++++++
lib/librte_ether/rte_ether_version.map | 1 +
4 files changed, 54 insertions(+), 1 deletion(-)
diff --git a/lib/librte_eal/common/include/rte_pci.h b/lib/librte_eal/common/include/rte_pci.h
index 83e3c28..334c12e 100644
--- a/lib/librte_eal/common/include/rte_pci.h
+++ b/lib/librte_eal/common/include/rte_pci.h
@@ -1,7 +1,7 @@
/*-
* BSD LICENSE
*
- * Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+ * Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -149,6 +149,7 @@ enum rte_kernel_driver {
RTE_KDRV_VFIO,
RTE_KDRV_UIO_GENERIC,
RTE_KDRV_NIC_UIO,
+ RTE_KDRV_NONE,
};
/**
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index 39f65bf..04eff73 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -3229,3 +3229,27 @@ rte_eth_dev_get_dcb_info(uint8_t port_id,
FUNC_PTR_OR_ERR_RET(*dev->dev_ops->get_dcb_info, -ENOTSUP);
return (*dev->dev_ops->get_dcb_info)(dev, dcb_info);
}
+
+void
+rte_eth_copy_pci_info(struct rte_eth_dev *eth_dev, struct rte_pci_device *pci_dev)
+{
+ if ((eth_dev == NULL) || (pci_dev == NULL)) {
+ PMD_DEBUG_TRACE("NULL pointer eth_dev=%p pci_dev=%p\n",
+ eth_dev, pci_dev);
+ }
+
+ eth_dev->data->dev_flags = 0;
+
+ if (pci_dev->driver->drv_flags & RTE_PCI_DRV_NEED_MAPPING)
+ eth_dev->data->dev_flags |= RTE_ETH_DEV_DRV_NEED_MAPPING;
+ if (pci_dev->driver->drv_flags & RTE_PCI_DRV_FORCE_UNBIND)
+ eth_dev->data->dev_flags |= RTE_ETH_DEV_DRV_FORCE_UNBIND;
+ 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->numa_node;
+ eth_dev->data->drv_name = pci_dev->driver->name;
+}
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index c835a2f..2e5b9b8 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -1551,8 +1551,21 @@ struct rte_eth_dev_data {
all_multicast : 1, /**< RX all multicast mode ON(1) / OFF(0). */
dev_started : 1, /**< Device state: STARTED(1) / STOPPED(0). */
lro : 1; /**< RX LRO is ON(1) / OFF(0) */
+ uint32_t dev_flags; /**< Flags controlling handling of device. */
+ enum rte_kernel_driver kdrv; /**< Kernel driver passthrough */
+ int numa_node; /**< NUMA node connection */
+ const char *drv_name; /**< Driver name */
};
+/** Device needs PCI BAR mapping (done with either IGB_UIO or VFIO) */
+#define RTE_ETH_DEV_DRV_NEED_MAPPING 0x0001
+/** Device needs to be unbound even if no module is provided */
+#define RTE_ETH_DEV_DRV_FORCE_UNBIND 0x0002
+/** Device supports link state interrupt */
+#define RTE_ETH_DEV_INTR_LSC 0x0003
+/** Device supports detaching capability */
+#define RTE_ETH_DEV_DETACHABLE 0x0004
+
/**
* @internal
* The pool of *rte_eth_dev* structures. The size of the pool
@@ -3733,6 +3746,20 @@ extern int rte_eth_timesync_read_rx_timestamp(uint8_t port_id,
extern int rte_eth_timesync_read_tx_timestamp(uint8_t port_id,
struct timespec *timestamp);
+/**
+ * Copy pci device info to the Ethernet device data.
+ *
+ * @param eth_dev
+ * The *eth_dev* pointer is the address of the *rte_eth_dev* structure.
+ * @param pci_dev
+ * The *pci_dev* pointer is the address of the *rte_pci_device* structure.
+ *
+ * @return
+ * - 0 on success, negative on error
+ */
+extern void rte_eth_copy_pci_info(struct rte_eth_dev *eth_dev, struct rte_pci_device *pci_dev);
+
+
#ifdef __cplusplus
}
#endif
diff --git a/lib/librte_ether/rte_ether_version.map b/lib/librte_ether/rte_ether_version.map
index 7b04e95..08c97f4 100644
--- a/lib/librte_ether/rte_ether_version.map
+++ b/lib/librte_ether/rte_ether_version.map
@@ -134,5 +134,6 @@ DPDK_2.2 {
rte_eth_dev_get_dcb_info;
rte_eth_rx_queue_info_get;
rte_eth_tx_queue_info_get;
+ rte_eth_copy_pci_info;
} DPDK_2.1;
--
1.9.1
next prev parent reply other threads:[~2015-11-03 13:02 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <PATCH v8>
2015-11-03 13:01 ` [dpdk-dev] [PATCH v8 00/11] remove pci driver from vdevs Bernard Iremonger
2015-11-03 13:01 ` Bernard Iremonger [this message]
2015-11-03 16:31 ` [dpdk-dev] [PATCH v8 01/11] librte_ether: add fields from rte_pci_driver to rte_eth_dev_data Thomas Monjalon
2015-11-03 13:01 ` [dpdk-dev] [PATCH v8 02/11] pdev: copy pci device info to eth_dev data Bernard Iremonger
2015-11-03 13:01 ` [dpdk-dev] [PATCH v8 03/11] vdev: copy " Bernard Iremonger
2015-11-03 17:17 ` Thomas Monjalon
2015-11-03 13:01 ` [dpdk-dev] [PATCH v8 04/11] librte_ether: remove branches on pci_dev Bernard Iremonger
2015-11-03 13:01 ` [dpdk-dev] [PATCH v8 05/11] null: remove pci device Bernard Iremonger
2015-11-03 13:02 ` [dpdk-dev] [PATCH v8 06/11] ring: " Bernard Iremonger
2015-11-03 13:02 ` [dpdk-dev] [PATCH v8 07/11] pcap: " Bernard Iremonger
2015-11-03 13:02 ` [dpdk-dev] [PATCH v8 08/11] af_packet: " Bernard Iremonger
2015-11-03 13:02 ` [dpdk-dev] [PATCH v8 09/11] xenvirt: " Bernard Iremonger
2015-11-03 13:02 ` [dpdk-dev] [PATCH v8 10/11] mpipe: " Bernard Iremonger
2015-11-03 13:02 ` [dpdk-dev] [PATCH v8 11/11] bonding: " Bernard Iremonger
2015-11-03 17:50 ` [dpdk-dev] [PATCH v8 00/11] remove pci driver from vdevs Thomas Monjalon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1446555725-19540-2-git-send-email-bernard.iremonger@intel.com \
--to=bernard.iremonger@intel.com \
--cc=dev@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).