From: Gaetan Rivet <gaetan.rivet@6wind.com>
To: dev@dpdk.org
Cc: Gaetan Rivet <gaetan.rivet@6wind.com>
Subject: [dpdk-dev] [PATCH v2 3/4] net/mlx4: net bus support
Date: Thu, 8 Jun 2017 02:01:00 +0200 [thread overview]
Message-ID: <d08ce4cbebe7420d10842a8ba56348d174478fda.1496877142.git.gaetan.rivet@6wind.com> (raw)
In-Reply-To: <cover.1496877142.git.gaetan.rivet@6wind.com>
In-Reply-To: <cover.1496877142.git.gaetan.rivet@6wind.com>
Signed-off-by: Gaetan Rivet <gaetan.rivet@6wind.com>
---
drivers/net/mlx4/mlx4.c | 35 +++++++++++++++++++++++++++++++++++
1 file changed, 35 insertions(+)
diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c
index b9554d5..9dfff5f 100644
--- a/drivers/net/mlx4/mlx4.c
+++ b/drivers/net/mlx4/mlx4.c
@@ -62,6 +62,7 @@
#include <rte_ethdev.h>
#include <rte_ethdev_pci.h>
#include <rte_dev.h>
+#include <rte_bus_net.h>
#include <rte_mbuf.h>
#include <rte_errno.h>
#include <rte_mempool.h>
@@ -6302,3 +6303,37 @@ RTE_PMD_EXPORT_NAME(net_mlx4, __COUNTER__);
RTE_PMD_REGISTER_PCI_TABLE(net_mlx4, mlx4_pci_id_map);
RTE_PMD_REGISTER_KMOD_DEP(net_mlx4,
"* ib_uverbs & mlx4_en & mlx4_core & mlx4_ib");
+
+static int
+mlx4_net_pci_xfrm(const struct rte_devargs *src,
+ struct rte_devargs *dst)
+{
+ char buf[32] = "";
+ size_t arglen;
+ int ret;
+
+ ret = rte_bus_net_pci_loc(src->name, buf, sizeof(buf));
+ if (ret)
+ return ret;
+ snprintf(dst->name, sizeof(dst->name), "%s", buf);
+ memset(buf, 0, sizeof(buf));
+ ret = rte_bus_net_path_read(buf, sizeof(buf),
+ "/sys/class/net/%s/dev_port", src->name);
+ if (ret)
+ return ret;
+ arglen = snprintf(NULL, 0, "port=%s,%s", buf, src->args) + 1;
+ dst->args = calloc(1, arglen);
+ if (dst->args == NULL)
+ return -ENOMEM;
+ snprintf(dst->args, arglen, "port=%s,%s", buf, src->args);
+ return 0;
+}
+
+static struct rte_net_driver mlx4_net_driver = {
+ .driver = {
+ .name = MLX4_DRIVER_NAME,
+ },
+ .kmod = "mlx4_core",
+ .xfrm = mlx4_net_pci_xfrm,
+};
+RTE_PMD_REGISTER_NET(mlx4, mlx4_net_driver);
--
2.1.4
next prev parent reply other threads:[~2017-06-08 0:01 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-01 10:44 [dpdk-dev] [PATCH 0/3] Introduce net bus Gaetan Rivet
2017-06-01 10:44 ` [dpdk-dev] [PATCH 1/3] bus/net: introduce " Gaetan Rivet
2017-06-01 10:44 ` [dpdk-dev] [PATCH 2/3] net/mlx4: net bus support Gaetan Rivet
2017-06-01 10:44 ` [dpdk-dev] [PATCH 3/3] net/mlx5: " Gaetan Rivet
2017-06-08 0:00 ` [dpdk-dev] [PATCH v2 0/4] Introduce net bus Gaetan Rivet
2017-06-08 0:00 ` [dpdk-dev] [PATCH v2 1/4] bus/net: introduce " Gaetan Rivet
2017-06-08 0:00 ` [dpdk-dev] [PATCH v2 2/4] bus/net: implement hotplug bus operations Gaetan Rivet
2017-06-08 0:01 ` Gaetan Rivet [this message]
2017-06-08 0:01 ` [dpdk-dev] [PATCH v2 4/4] net/mlx5: net bus support Gaetan Rivet
2017-06-08 7:31 ` [dpdk-dev] [PATCH v2 0/4] Introduce net bus Thomas Monjalon
2017-06-08 20:31 ` Gaëtan Rivet
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=d08ce4cbebe7420d10842a8ba56348d174478fda.1496877142.git.gaetan.rivet@6wind.com \
--to=gaetan.rivet@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).