* [dpdk-dev] [PATCH 1/3] bond: move param parsing in dev_configure
2014-08-26 14:12 [dpdk-dev] [PATCH 0/3] eal / bonding pmd cleanup David Marchand
@ 2014-08-26 14:12 ` David Marchand
2014-08-26 14:12 ` [dpdk-dev] [PATCH 2/3] Revert "eal: support link bonding device initialization" David Marchand
` (2 subsequent siblings)
3 siblings, 0 replies; 8+ messages in thread
From: David Marchand @ 2014-08-26 14:12 UTC (permalink / raw)
To: dev
Rework bond pmd initialisation so that we don't need to modify eal for this pmd
to work.
Signed-off-by: David Marchand <david.marchand@6wind.com>
---
lib/librte_pmd_bond/rte_eth_bond_pmd.c | 33 ++++++++++++++++++++++------
lib/librte_pmd_bond/rte_eth_bond_private.h | 2 ++
2 files changed, 28 insertions(+), 7 deletions(-)
diff --git a/lib/librte_pmd_bond/rte_eth_bond_pmd.c b/lib/librte_pmd_bond/rte_eth_bond_pmd.c
index d72d6ed..42cf37a 100644
--- a/lib/librte_pmd_bond/rte_eth_bond_pmd.c
+++ b/lib/librte_pmd_bond/rte_eth_bond_pmd.c
@@ -707,11 +707,8 @@ bond_ethdev_close(struct rte_eth_dev *dev __rte_unused)
{
}
-static int
-bond_ethdev_configure(struct rte_eth_dev *dev __rte_unused)
-{
- return 0;
-}
+/* forward declaration */
+static int bond_ethdev_configure(struct rte_eth_dev *dev);
static void
bond_ethdev_info(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
@@ -1027,6 +1024,7 @@ struct eth_dev_ops default_dev_ops = {
static int
bond_init(const char *name, const char *params)
{
+ struct bond_dev_private *internals;
struct rte_kvargs *kvlist;
uint8_t bonding_mode, socket_id;
int arg_count, port_id;
@@ -1078,10 +1076,31 @@ bond_init(const char *name, const char *params)
name, bonding_mode, socket_id);
return -1;
}
+ internals = rte_eth_devices[port_id].data->dev_private;
+ internals->kvlist = kvlist;
RTE_LOG(INFO, EAL,
"Create bonded device %s on port %d in mode %u on socket %u.\n",
name, port_id, bonding_mode, socket_id);
+ return 0;
+}
+
+/* this part will resolve the slave portids after all the other pdev and vdev
+ * have been allocated */
+static int
+bond_ethdev_configure(struct rte_eth_dev *dev)
+{
+ char *name = dev->data->name;
+ struct bond_dev_private *internals = dev->data->dev_private;
+ struct rte_kvargs *kvlist = internals->kvlist;
+ int arg_count, port_id = dev - rte_eth_devices;
+
+ /*
+ * if no kvlist, it means that this bonded device has been created
+ * through the bonding api.
+ */
+ if (!kvlist)
+ return 0;
/* Parse MAC address for bonded device */
arg_count = rte_kvargs_count(kvlist, PMD_BOND_MAC_ADDR_KVARG);
@@ -1199,8 +1218,8 @@ bond_init(const char *name, const char *params)
}
static struct rte_driver bond_drv = {
- .name = PMD_BOND_NAME,
- .type = PMD_BDEV,
+ .name = "eth_bond",
+ .type = PMD_VDEV,
.init = bond_init,
};
diff --git a/lib/librte_pmd_bond/rte_eth_bond_private.h b/lib/librte_pmd_bond/rte_eth_bond_private.h
index 60f1e8d..1db6e4d 100644
--- a/lib/librte_pmd_bond/rte_eth_bond_private.h
+++ b/lib/librte_pmd_bond/rte_eth_bond_private.h
@@ -123,6 +123,8 @@ struct bond_dev_private {
/** Persisted configuration of slaves */
struct slave_conf presisted_slaves_conf[RTE_MAX_ETHPORTS];
+
+ struct rte_kvargs *kvlist;
};
extern struct eth_dev_ops default_dev_ops;
--
1.7.10.4
^ permalink raw reply [flat|nested] 8+ messages in thread
* [dpdk-dev] [PATCH 2/3] Revert "eal: support link bonding device initialization"
2014-08-26 14:12 [dpdk-dev] [PATCH 0/3] eal / bonding pmd cleanup David Marchand
2014-08-26 14:12 ` [dpdk-dev] [PATCH 1/3] bond: move param parsing in dev_configure David Marchand
@ 2014-08-26 14:12 ` David Marchand
2014-08-26 14:12 ` [dpdk-dev] [PATCH 3/3] eal: probe pci devices at rte_eal_init time David Marchand
2014-09-16 13:05 ` [dpdk-dev] [PATCH 0/3] eal / bonding pmd cleanup David Marchand
3 siblings, 0 replies; 8+ messages in thread
From: David Marchand @ 2014-08-26 14:12 UTC (permalink / raw)
To: dev
This reverts commit a155d430119d947d3cb03136ce50924a642dbfe0.
Signed-off-by: David Marchand <david.marchand@6wind.com>
---
lib/librte_eal/bsdapp/eal/eal.c | 10 +----
lib/librte_eal/common/eal_common_dev.c | 58 +++++++++------------------
lib/librte_eal/common/eal_common_pci.c | 3 --
lib/librte_eal/common/include/eal_private.h | 7 ++++
lib/librte_eal/common/include/rte_dev.h | 14 +------
lib/librte_eal/linuxapp/eal/eal.c | 11 +----
6 files changed, 29 insertions(+), 74 deletions(-)
diff --git a/lib/librte_eal/bsdapp/eal/eal.c b/lib/librte_eal/bsdapp/eal/eal.c
index dad9e0c..6ca8758 100644
--- a/lib/librte_eal/bsdapp/eal/eal.c
+++ b/lib/librte_eal/bsdapp/eal/eal.c
@@ -898,7 +898,7 @@ rte_eal_init(int argc, char **argv)
rte_eal_mcfg_complete();
- if (rte_eal_dev_init(PMD_INIT_PRE_PCI_PROBE) < 0)
+ if (rte_eal_dev_init() < 0)
rte_panic("Cannot init pmd devices\n");
RTE_LCORE_FOREACH_SLAVE(i) {
@@ -930,14 +930,6 @@ rte_eal_init(int argc, char **argv)
rte_eal_mp_remote_launch(sync_func, NULL, SKIP_MASTER);
rte_eal_mp_wait_lcore();
- /* Probe & Initialize PCI devices */
- if (rte_eal_pci_probe())
- rte_panic("Cannot probe PCI\n");
-
- /* Initialize any outstanding devices */
- if (rte_eal_dev_init(PMD_INIT_POST_PCI_PROBE) < 0)
- rte_panic("Cannot init pmd devices\n");
-
return fctret;
}
diff --git a/lib/librte_eal/common/eal_common_dev.c b/lib/librte_eal/common/eal_common_dev.c
index 1194419..eae5656 100644
--- a/lib/librte_eal/common/eal_common_dev.c
+++ b/lib/librte_eal/common/eal_common_dev.c
@@ -62,7 +62,7 @@ rte_eal_driver_unregister(struct rte_driver *driver)
}
int
-rte_eal_dev_init(uint8_t init_pri)
+rte_eal_dev_init(void)
{
struct rte_devargs *devargs;
struct rte_driver *driver;
@@ -80,52 +80,30 @@ rte_eal_dev_init(uint8_t init_pri)
continue;
TAILQ_FOREACH(driver, &dev_driver_list, next) {
- /* RTE_DEVTYPE_VIRTUAL can only be a virtual or bonded device,
- * virtual devices are initialized pre PCI probing and bonded
- * device are post pci probing */
- if ((driver->type == PMD_VDEV && init_pri ==
- PMD_INIT_PRE_PCI_PROBE) ||
- (driver->type == PMD_BDEV && init_pri ==
- PMD_INIT_POST_PCI_PROBE)) {
+ if (driver->type != PMD_VDEV)
+ continue;
- /* search a driver prefix in virtual device name */
- if (!strncmp(driver->name, devargs->virtual.drv_name,
- strlen(driver->name))) {
- printf("init (%u) %s\n", init_pri, devargs->virtual.drv_name);
- driver->init(devargs->virtual.drv_name,
- devargs->args);
- break;
- }
+ /* search a driver prefix in virtual device name */
+ if (!strncmp(driver->name, devargs->virtual.drv_name,
+ strlen(driver->name))) {
+ driver->init(devargs->virtual.drv_name,
+ devargs->args);
+ break;
}
}
- /* If initializing pre PCI probe, then we don't expect a bonded driver
- * to be found */
- if (init_pri == PMD_INIT_PRE_PCI_PROBE &&
- strncmp(PMD_BOND_NAME, devargs->virtual.drv_name,
- strlen(PMD_BOND_NAME)) != 0) {
- if (driver == NULL) {
- rte_panic("no driver found for virtual device %s\n",
- devargs->virtual.drv_name);
- }
- } else if (init_pri == PMD_INIT_POST_PCI_PROBE &&
- strncmp(PMD_BOND_NAME, devargs->virtual.drv_name,
- strlen(PMD_BOND_NAME)) == 0) {
- if (driver == NULL) {
- rte_panic("no driver found for bonded device %s\n",
- devargs->virtual.drv_name);
- }
+ if (driver == NULL) {
+ rte_panic("no driver found for %s\n",
+ devargs->virtual.drv_name);
}
}
- /* Once the vdevs are initialized, start calling all the pdev drivers */
- if (init_pri == PMD_INIT_PRE_PCI_PROBE) {
- TAILQ_FOREACH(driver, &dev_driver_list, next) {
- if (driver->type != PMD_PDEV)
- continue;
- /* PDEV drivers don't get passed any parameters */
- driver->init(NULL, NULL);
- }
+ /* Once the vdevs are initalized, start calling all the pdev drivers */
+ TAILQ_FOREACH(driver, &dev_driver_list, next) {
+ if (driver->type != PMD_PDEV)
+ continue;
+ /* PDEV drivers don't get passed any parameters */
+ driver->init(NULL, NULL);
}
return 0;
}
diff --git a/lib/librte_eal/common/eal_common_pci.c b/lib/librte_eal/common/eal_common_pci.c
index c637361..af809a8 100644
--- a/lib/librte_eal/common/eal_common_pci.c
+++ b/lib/librte_eal/common/eal_common_pci.c
@@ -150,9 +150,6 @@ rte_eal_pci_probe(void)
probe_all = 1;
TAILQ_FOREACH(dev, &pci_device_list, next) {
- /* check if device has already been initialized */
- if (dev->driver != NULL)
- continue;
/* set devargs in PCI structure */
devargs = pci_devargs_lookup(dev);
diff --git a/lib/librte_eal/common/include/eal_private.h b/lib/librte_eal/common/include/eal_private.h
index b440ffb..232fcec 100644
--- a/lib/librte_eal/common/include/eal_private.h
+++ b/lib/librte_eal/common/include/eal_private.h
@@ -196,4 +196,11 @@ int rte_eal_intr_init(void);
*/
int rte_eal_alarm_init(void);
+/**
+ * This function initialises any virtual devices
+ *
+ * This function is private to the EAL.
+ */
+int rte_eal_dev_init(void);
+
#endif /* _EAL_PRIVATE_H_ */
diff --git a/lib/librte_eal/common/include/rte_dev.h b/lib/librte_eal/common/include/rte_dev.h
index d89f1a5..f7e3a10 100644
--- a/lib/librte_eal/common/include/rte_dev.h
+++ b/lib/librte_eal/common/include/rte_dev.h
@@ -62,16 +62,6 @@ typedef int (rte_dev_init_t)(const char *name, const char *args);
enum pmd_type {
PMD_VDEV = 0,
PMD_PDEV = 1,
- PMD_BDEV = 2, /**< Poll Mode Driver Bonded Device*/
-};
-
-#define PMD_BOND_NAME "eth_bond"
-
-/**
- * Driver initialization */
-enum pmd_init_priority {
- PMD_INIT_PRE_PCI_PROBE = 0,
- PMD_INIT_POST_PCI_PROBE = 1,
};
/**
@@ -103,9 +93,9 @@ void rte_eal_driver_register(struct rte_driver *driver);
void rte_eal_driver_unregister(struct rte_driver *driver);
/**
- * Initialize all the registered drivers in this process
+ * Initalize all the registered drivers in this process
*/
-int rte_eal_dev_init(uint8_t init_priority);
+int rte_eal_dev_init(void);
#define PMD_REGISTER_DRIVER(d)\
void devinitfn_ ##d(void);\
diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c
index 884aa9b..392bedf 100644
--- a/lib/librte_eal/linuxapp/eal/eal.c
+++ b/lib/librte_eal/linuxapp/eal/eal.c
@@ -75,7 +75,6 @@
#include <rte_atomic.h>
#include <malloc_heap.h>
#include <rte_eth_ring.h>
-#include <rte_dev.h>
#include "eal_private.h"
#include "eal_thread.h"
@@ -1178,7 +1177,7 @@ rte_eal_init(int argc, char **argv)
RTE_LOG(DEBUG, EAL, "Master core %u is ready (tid=%x)\n",
rte_config.master_lcore, (int)thread_id);
- if (rte_eal_dev_init(PMD_INIT_PRE_PCI_PROBE) < 0)
+ if (rte_eal_dev_init() < 0)
rte_panic("Cannot init pmd devices\n");
RTE_LCORE_FOREACH_SLAVE(i) {
@@ -1208,14 +1207,6 @@ rte_eal_init(int argc, char **argv)
rte_eal_mp_remote_launch(sync_func, NULL, SKIP_MASTER);
rte_eal_mp_wait_lcore();
- /* Probe & Initialize PCI devices */
- if (rte_eal_pci_probe())
- rte_panic("Cannot probe PCI\n");
-
- /* Initialize any outstanding devices */
- if (rte_eal_dev_init(PMD_INIT_POST_PCI_PROBE) < 0)
- rte_panic("Cannot init pmd devices\n");
-
return fctret;
}
--
1.7.10.4
^ permalink raw reply [flat|nested] 8+ messages in thread