[dpdk-dev] ethdev: add notifications for probing and removal

Message ID 20171128221302.15400-1-thomas@monjalon.net (mailing list archive)
State Superseded, archived
Delegated to: Ferruh Yigit
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation fail Compilation issues

Commit Message

Thomas Monjalon Nov. 28, 2017, 10:13 p.m. UTC
  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(+)
  

Comments

Ferruh Yigit Dec. 22, 2017, 3:17 a.m. UTC | #1
On 11/28/2017 2:13 PM, Thomas Monjalon wrote:
> 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>

> ---
> 
> This patch depends on:
> - ethdev: remove useless parameter in callback process
> - ethdev: free a port by a dedicated API

What do you think pulling that patch from port ownership patchset, which is
still under discussion, to this one? Is it required for port ownership one?
  
Thomas Monjalon Dec. 22, 2017, 8:39 a.m. UTC | #2
22/12/2017 04:17, Ferruh Yigit:
> On 11/28/2017 2:13 PM, Thomas Monjalon wrote:
> > 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>
> 
> > ---
> > 
> > This patch depends on:
> > - ethdev: remove useless parameter in callback process
> > - ethdev: free a port by a dedicated API
> 
> What do you think pulling that patch from port ownership patchset, which is
> still under discussion, to this one? Is it required for port ownership one?

It can be used with port ownership, but they are two separate things.
  
Thomas Monjalon Dec. 29, 2017, 1:12 p.m. UTC | #3
This patchset aims to add notifications for ethdev ports
added or removed.
It will be especially useful for hotplug.

The first patches were sent individually by Matan,
and now grouped in a consistent patchset v2.

Note: this patchset depends on
"ethdev: remove useless parameter in callback process"

Matan Azrad (2):
  ethdev: allow event registration for all ports
  ethdev: free detached port by the dedicated function

Thomas Monjalon (1):
  ethdev: add notifications for probing and removal

 lib/librte_ether/rte_ethdev.c | 128 +++++++++++++++++++++++++++++-------------
 lib/librte_ether/rte_ethdev.h |  10 +++-
 2 files changed, 96 insertions(+), 42 deletions(-)
  
Thomas Monjalon Dec. 29, 2017, 1:36 p.m. UTC | #4
This patchset aims to add notifications for ethdev ports
added or removed.
It will be especially useful for hotplug.

This v3 is gathering more related patches which were sent
individually (callback process cleanup and testpmd additions).

Matan Azrad (3):
  ethdev: allow event registration for all ports
  ethdev: free detached port by the dedicated function
  app/testpmd: extend event printing

Thomas Monjalon (2):
  ethdev: remove useless parameter in callback process
  ethdev: add notifications for probing and removal

 app/test-pmd/parameters.c               |   4 +
 app/test-pmd/testpmd.c                  |  30 ++++----
 doc/guides/prog_guide/poll_mode_drv.rst |   4 +-
 doc/guides/testpmd_app_ug/run_app.rst   |   4 +-
 drivers/net/bnxt/rte_pmd_bnxt.c         |   2 +-
 drivers/net/bonding/rte_eth_bond_pmd.c  |   6 +-
 drivers/net/dpaa2/dpaa2_ethdev.c        |   2 +-
 drivers/net/e1000/em_ethdev.c           |   2 +-
 drivers/net/e1000/igb_ethdev.c          |   4 +-
 drivers/net/enic/enic_main.c            |   2 +-
 drivers/net/failsafe/failsafe_ether.c   |   2 +-
 drivers/net/fm10k/fm10k_ethdev.c        |   8 +-
 drivers/net/i40e/i40e_ethdev.c          |   2 +-
 drivers/net/i40e/i40e_ethdev_vf.c       |   2 +-
 drivers/net/i40e/i40e_pf.c              |   3 +-
 drivers/net/ixgbe/ixgbe_ethdev.c        |   6 +-
 drivers/net/ixgbe/ixgbe_pf.c            |   4 +-
 drivers/net/mlx4/mlx4_intr.c            |   4 +-
 drivers/net/mlx5/mlx5_ethdev.c          |   9 +--
 drivers/net/nfp/nfp_net.c               |   2 +-
 drivers/net/sfc/sfc_intr.c              |   4 +-
 drivers/net/thunderx/nicvf_ethdev.c     |   2 +-
 drivers/net/vhost/rte_eth_vhost.c       |   9 +--
 drivers/net/virtio/virtio_ethdev.c      |   2 +-
 drivers/net/vmxnet3/vmxnet3_ethdev.c    |   2 +-
 lib/librte_ether/rte_ethdev.c           | 132 +++++++++++++++++++++-----------
 lib/librte_ether/rte_ethdev.h           |  14 ++--
 test/test/virtual_pmd.c                 |   2 +-
 28 files changed, 159 insertions(+), 110 deletions(-)
  
Thomas Monjalon Jan. 4, 2018, 4:01 p.m. UTC | #5
This patchset aims to add notifications for ethdev ports
added or removed.
It will be especially useful for hotplug.

v2 & v3 changes: gather more patches in the series
v4 change: fix a variable wraparound as in Matan's v1

Matan Azrad (3):
  ethdev: allow event registration for all ports
  ethdev: free detached port by the dedicated function
  app/testpmd: extend event printing

Thomas Monjalon (2):
  ethdev: remove useless parameter in callback process
  ethdev: add notifications for probing and removal

 app/test-pmd/parameters.c               |   4 +
 app/test-pmd/testpmd.c                  |  30 ++++----
 doc/guides/prog_guide/poll_mode_drv.rst |   4 +-
 doc/guides/testpmd_app_ug/run_app.rst   |   4 +-
 drivers/net/bnxt/rte_pmd_bnxt.c         |   2 +-
 drivers/net/bonding/rte_eth_bond_pmd.c  |   6 +-
 drivers/net/dpaa2/dpaa2_ethdev.c        |   2 +-
 drivers/net/e1000/em_ethdev.c           |   2 +-
 drivers/net/e1000/igb_ethdev.c          |   4 +-
 drivers/net/enic/enic_main.c            |   2 +-
 drivers/net/failsafe/failsafe_ether.c   |   2 +-
 drivers/net/fm10k/fm10k_ethdev.c        |   8 +-
 drivers/net/i40e/i40e_ethdev.c          |   2 +-
 drivers/net/i40e/i40e_ethdev_vf.c       |   2 +-
 drivers/net/i40e/i40e_pf.c              |   3 +-
 drivers/net/ixgbe/ixgbe_ethdev.c        |   6 +-
 drivers/net/ixgbe/ixgbe_pf.c            |   4 +-
 drivers/net/mlx4/mlx4_intr.c            |   4 +-
 drivers/net/mlx5/mlx5_ethdev.c          |   9 +--
 drivers/net/nfp/nfp_net.c               |   2 +-
 drivers/net/sfc/sfc_intr.c              |   4 +-
 drivers/net/thunderx/nicvf_ethdev.c     |   2 +-
 drivers/net/vhost/rte_eth_vhost.c       |   9 +--
 drivers/net/virtio/virtio_ethdev.c      |   2 +-
 drivers/net/vmxnet3/vmxnet3_ethdev.c    |   2 +-
 lib/librte_ether/rte_ethdev.c           | 132 +++++++++++++++++++++-----------
 lib/librte_ether/rte_ethdev.h           |  14 ++--
 test/test/virtual_pmd.c                 |   2 +-
 28 files changed, 159 insertions(+), 110 deletions(-)
  
Ferruh Yigit Jan. 10, 2018, 9:19 p.m. UTC | #6
On 1/4/2018 4:01 PM, Thomas Monjalon wrote:
> This patchset aims to add notifications for ethdev ports
> added or removed.
> It will be especially useful for hotplug.
> 
> v2 & v3 changes: gather more patches in the series
> v4 change: fix a variable wraparound as in Matan's v1
> 
> Matan Azrad (3):
>   ethdev: allow event registration for all ports
>   ethdev: free detached port by the dedicated function
>   app/testpmd: extend event printing
> 
> Thomas Monjalon (2):
>   ethdev: remove useless parameter in callback process
>   ethdev: add notifications for probing and removal

Series applied to dpdk-next-net/master, thanks.
  

Patch

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 */
 };