From: Thomas Monjalon <thomas@monjalon.net>
To: dev@dpdk.org
Cc: matan@mellanox.com
Subject: [PATCH] ethdev: add notifications for probing and removal
Date: Tue, 28 Nov 2017 23:13:02 +0100 [thread overview]
Message-ID: <20171128221302.15400-1-thomas@monjalon.net> (raw)
When a PMD finishes probing, it creates the new port by calling
the function rte_eth_dev_allocate().
A notification of the new port is sent there to the upper layer.
When a PMD finishes removal of a port, it calls the function
rte_eth_dev_release_port().
A notification of the destroyed port is sent there to the upper layer.
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
This patch depends on:
- ethdev: remove useless parameter in callback process
- ethdev: free a port by a dedicated API
---
lib/librte_ether/rte_ethdev.c | 5 +++++
lib/librte_ether/rte_ethdev.h | 2 ++
2 files changed, 7 insertions(+)
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index c196c3692..517e6546f 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -238,6 +238,8 @@ rte_eth_dev_allocate(const char *name)
eth_dev->data->port_id = port_id;
eth_dev->data->mtu = ETHER_MTU;
+ _rte_eth_dev_callback_process(eth_dev, RTE_ETH_EVENT_NEW, NULL);
+
return eth_dev;
}
@@ -279,6 +281,9 @@ rte_eth_dev_release_port(struct rte_eth_dev *eth_dev)
return -EINVAL;
eth_dev->state = RTE_ETH_DEV_UNUSED;
+
+ _rte_eth_dev_callback_process(eth_dev, RTE_ETH_EVENT_DESTROY, NULL);
+
return 0;
}
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index 15309aa7c..6986ee2a0 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -3526,6 +3526,8 @@ enum rte_eth_event_type {
RTE_ETH_EVENT_VF_MBOX, /**< message from the VF received by PF */
RTE_ETH_EVENT_MACSEC, /**< MACsec offload related event */
RTE_ETH_EVENT_INTR_RMV, /**< device removal event */
+ RTE_ETH_EVENT_NEW, /**< port is probed */
+ RTE_ETH_EVENT_DESTROY, /**< port is released */
RTE_ETH_EVENT_MAX /**< max value of this enum */
};
--
2.15.0
next reply other threads:[~2017-11-28 22:13 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-28 22:13 Thomas Monjalon [this message]
2017-12-22 3:17 ` [PATCH] ethdev: add notifications for probing and removal Ferruh Yigit
2017-12-22 8:39 ` Thomas Monjalon
2017-12-29 13:12 ` [PATCH v2 0/3] ethdev port notifications Thomas Monjalon
2017-12-29 13:12 ` [PATCH v2 1/3] ethdev: allow event registration for all ports Thomas Monjalon
2017-12-29 13:12 ` [PATCH v2 2/3] ethdev: free detached port by the dedicated function Thomas Monjalon
2017-12-29 13:12 ` [PATCH v2 3/3] ethdev: add notifications for probing and removal Thomas Monjalon
2017-12-29 13:36 ` [PATCH v3 0/5] ethdev port notifications Thomas Monjalon
2017-12-29 13:36 ` [PATCH v3 1/5] ethdev: remove useless parameter in callback process Thomas Monjalon
2018-01-02 11:35 ` Iremonger, Bernard
2018-01-02 12:21 ` Neil Horman
2018-01-03 8:17 ` Thomas Monjalon
2017-12-29 13:36 ` [PATCH v3 2/5] ethdev: allow event registration for all ports Thomas Monjalon
2017-12-29 13:36 ` [PATCH v3 3/5] ethdev: free detached port by the dedicated function Thomas Monjalon
2017-12-29 13:36 ` [PATCH v3 4/5] ethdev: add notifications for probing and removal Thomas Monjalon
2017-12-29 13:36 ` [PATCH v3 5/5] app/testpmd: extend event printing Thomas Monjalon
2018-01-04 16:01 ` [PATCH v4 0/5] ethdev port notifications Thomas Monjalon
2018-01-04 16:01 ` [PATCH v4 1/5] ethdev: remove useless parameter in callback process Thomas Monjalon
2018-01-04 16:01 ` [PATCH v4 2/5] ethdev: allow event registration for all ports Thomas Monjalon
2018-01-04 16:01 ` [PATCH v4 3/5] ethdev: free detached port by the dedicated function Thomas Monjalon
2018-01-04 16:01 ` [PATCH v4 4/5] ethdev: add notifications for probing and removal Thomas Monjalon
2018-01-04 16:01 ` [PATCH v4 5/5] app/testpmd: extend event printing Thomas Monjalon
2018-01-04 16:03 ` Thomas Monjalon
2018-01-10 21:02 ` Ferruh Yigit
2018-01-10 21:19 ` [PATCH v4 0/5] ethdev port notifications Ferruh Yigit
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=20171128221302.15400-1-thomas@monjalon.net \
--to=thomas@monjalon.net \
--cc=dev@dpdk.org \
--cc=matan@mellanox.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.