All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Monjalon <thomas@monjalon.net>
To: dev@dpdk.org
Cc: ferruh.yigit@intel.com
Subject: [PATCH v4 4/5] ethdev: add notifications for probing and removal
Date: Thu,  4 Jan 2018 17:01:11 +0100	[thread overview]
Message-ID: <20180104160112.28651-5-thomas@monjalon.net> (raw)
In-Reply-To: <20180104160112.28651-1-thomas@monjalon.net>

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>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
---
v2: no change
v3: no change
v4: no change
---
 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 8700f6f43..7c1f7eef9 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -237,6 +237,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;
 }
 
@@ -278,6 +280,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 c92508cfd..11f97e709 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -3528,6 +3528,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.1

  parent reply	other threads:[~2018-01-04 16:01 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-28 22:13 [PATCH] ethdev: add notifications for probing and removal Thomas Monjalon
2017-12-22  3:17 ` 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   ` Thomas Monjalon [this message]
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=20180104160112.28651-5-thomas@monjalon.net \
    --to=thomas@monjalon.net \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.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.