DPDK patches and discussions
 help / color / mirror / Atom feed
From: Tetsuya Mukawa <mukawa@igel.co.jp>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH v4 2/2] librte_pmd_null: Support port hotplug function
Date: Tue, 20 Jan 2015 12:00:21 +0900	[thread overview]
Message-ID: <1421722821-18158-2-git-send-email-mukawa@igel.co.jp> (raw)
In-Reply-To: <1421722821-18158-1-git-send-email-mukawa@igel.co.jp>

This patch adds port hotplug support to null PMD.

v4:
- Fix commit title.

Signed-off-by: Tetsuya Mukawa <mukawa@igel.co.jp>
---
 lib/librte_pmd_null/rte_eth_null.c | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/lib/librte_pmd_null/rte_eth_null.c b/lib/librte_pmd_null/rte_eth_null.c
index c54e90b..e9b1eee 100644
--- a/lib/librte_pmd_null/rte_eth_null.c
+++ b/lib/librte_pmd_null/rte_eth_null.c
@@ -292,6 +292,13 @@ eth_stats_reset(struct rte_eth_dev *dev)
 	}
 }
 
+static struct eth_driver rte_null_pmd = {
+	.pci_drv = {
+		.name = "rte_null_pmd",
+		.drv_flags = RTE_PCI_DRV_DETACHABLE,
+	},
+};
+
 static void
 eth_queue_release(void *q)
 {
@@ -382,10 +389,12 @@ eth_dev_null_create(const char *name __rte_unused,
 	data->nb_tx_queues = (uint16_t)nb_tx_queues;
 	data->dev_link = pmd_link;
 	data->mac_addrs = &eth_addr;
+	strncpy(data->name, eth_dev->data->name, strlen(eth_dev->data->name));
 
 	eth_dev->data = data;
 	eth_dev->dev_ops = &ops;
 	eth_dev->pci_dev = pci_dev;
+	eth_dev->driver = &rte_null_pmd;
 
 	/* finally assign rx and tx ops */
 	if (packet_copy) {
@@ -476,10 +485,33 @@ rte_pmd_null_devinit(const char *name, const char *params)
 	return eth_dev_null_create(name, numa_node, packet_size, packet_copy);
 }
 
+static int
+rte_pmd_null_devuninit(const char *name, const char *params __rte_unused)
+{
+	struct rte_eth_dev *eth_dev = NULL;
+
+	RTE_LOG(INFO, PMD, "Closing null ethdev on numa socket %u\n",
+			rte_socket_id());
+
+	/* reserve an ethdev entry */
+	eth_dev = rte_eth_dev_allocated(name);
+	if (eth_dev == NULL)
+		return -1;
+
+	rte_free(eth_dev->data->dev_private);
+	rte_free(eth_dev->data);
+	rte_free(eth_dev->pci_dev);
+
+	rte_eth_dev_free(name);
+
+	return 0;
+}
+
 static struct rte_driver pmd_null_drv = {
 	.name = "eth_null",
 	.type = PMD_VDEV,
 	.init = rte_pmd_null_devinit,
+	.uninit = rte_pmd_null_devuninit,
 };
 
 PMD_REGISTER_DRIVER(pmd_null_drv);
-- 
1.9.1

  reply	other threads:[~2015-01-20  3:00 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mukawa@igel.co.jp>
2014-10-01  4:57 ` [dpdk-dev] [PATCH v2] PMD for performance measurement mukawa
2014-10-01  4:57   ` [dpdk-dev] [PATCH v2] librte_pmd_null: Add null PMD mukawa
2014-11-13 12:17     ` Thomas Monjalon
2014-12-16  8:39     ` [dpdk-dev] [PATCH v3] " Tetsuya Mukawa
2014-12-16  8:44       ` Tetsuya Mukawa
2014-12-16  8:47         ` Thomas Monjalon
2014-12-16  8:49           ` Tetsuya Mukawa
2015-01-20  3:00       ` [dpdk-dev] [PATCH v4 1/2] " Tetsuya Mukawa
2015-01-20  3:00         ` Tetsuya Mukawa [this message]
2015-02-06  4:38           ` [dpdk-dev] [PATCH v6 " Tetsuya Mukawa
2015-02-06  4:38             ` [dpdk-dev] [PATCH v6 2/2] librte_pmd_null: Support port hotplug function Tetsuya Mukawa
2015-02-06 11:37               ` Iremonger, Bernard
2015-02-06 11:32             ` [dpdk-dev] [PATCH v6 1/2] librte_pmd_null: Add null PMD Iremonger, Bernard
2015-02-09  8:54               ` Tetsuya Mukawa
2015-02-12  2:44             ` [dpdk-dev] [PATCH v7 1/2] librte_pmd_null: Add Null PMD Tetsuya Mukawa
2015-02-12  2:44               ` [dpdk-dev] [PATCH v7 2/2] librte_pmd_null: Support port hotplug function Tetsuya Mukawa
2015-02-16  4:19               ` [dpdk-dev] [PATCH v8 1/2] librte_pmd_null: Add Null PMD Tetsuya Mukawa
2015-02-16  4:19                 ` [dpdk-dev] [PATCH v8 2/2] librte_pmd_null: Support port hotplug function Tetsuya Mukawa
2015-02-16 16:38                   ` Iremonger, Bernard
2015-02-16 16:38                 ` [dpdk-dev] [PATCH v8 1/2] librte_pmd_null: Add Null PMD Iremonger, Bernard
2015-02-19 10:41                 ` [dpdk-dev] [PATCH v9 " Tetsuya Mukawa
2015-02-19 10:41                   ` [dpdk-dev] [PATCH v9 2/2] librte_pmd_null: Support port hotplug function Tetsuya Mukawa
2015-02-20  6:41                   ` [dpdk-dev] [PATCH v10 1/2] librte_pmd_null: Add Null PMD Tetsuya Mukawa
2015-02-20  6:41                     ` [dpdk-dev] [PATCH v10 2/2] librte_pmd_null: Support port hotplug function Tetsuya Mukawa
2015-02-23  5:12                     ` [dpdk-dev] [PATCH v11 1/2] librte_pmd_null: Add Null PMD Tetsuya Mukawa
2015-02-23  5:12                       ` [dpdk-dev] [PATCH v11 2/2] librte_pmd_null: Support port hotplug function Tetsuya Mukawa
2015-02-25 23:35                         ` Thomas Monjalon
2015-02-26  0:49                           ` Stephen Hemminger
2015-02-26  7:03                             ` Thomas Monjalon
2015-02-26  9:06                               ` Tetsuya Mukawa
2015-02-26 10:57                                 ` Thomas Monjalon
2015-02-26 11:50                                   ` Tetsuya Mukawa
2015-03-04  3:37                                   ` Tetsuya Mukawa
2015-02-26 12:21                                 ` Mcnamara, John
2015-02-26 15:36                                   ` Mcnamara, John
2015-02-27  1:31                                     ` Tetsuya Mukawa
2015-02-27 23:29                                   ` 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=1421722821-18158-2-git-send-email-mukawa@igel.co.jp \
    --to=mukawa@igel.co.jp \
    --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).