From: David Marchand <david.marchand@6wind.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH 1/3] bond: move param parsing in dev_configure
Date: Tue, 26 Aug 2014 16:12:16 +0200 [thread overview]
Message-ID: <1409062338-26477-2-git-send-email-david.marchand@6wind.com> (raw)
In-Reply-To: <1409062338-26477-1-git-send-email-david.marchand@6wind.com>
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
next prev parent reply other threads:[~2014-08-26 14:08 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-26 14:12 [dpdk-dev] [PATCH 0/3] eal / bonding pmd cleanup David Marchand
2014-08-26 14:12 ` David Marchand [this message]
2014-08-26 14:12 ` [dpdk-dev] [PATCH 2/3] Revert "eal: support link bonding device initialization" 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
2014-09-22 11:02 ` David Marchand
2014-09-22 13:04 ` Neil Horman
2014-09-29 12:12 ` 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=1409062338-26477-2-git-send-email-david.marchand@6wind.com \
--to=david.marchand@6wind.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).