DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ophir Munk <ophirmu@mellanox.com>
To: "dev@dpdk.org" <dev@dpdk.org>, Yongseok Koh <yskoh@mellanox.com>,
	Ophir Munk <ophirmu@mellanox.com>
Cc: Thomas Monjalon <thomas@monjalon.net>,
	Olga Shern <olgas@mellanox.com>, Asaf Penso <asafp@mellanox.com>,
	Shahaf Shuler <shahafs@mellanox.com>
Subject: [dpdk-dev] [PATCH v4 2/3] net/mlx5: release port on close
Date: Tue, 23 Oct 2018 18:26:04 +0000	[thread overview]
Message-ID: <1540319157-11191-2-git-send-email-ophirmu@mellanox.com> (raw)
In-Reply-To: <1540319157-11191-1-git-send-email-ophirmu@mellanox.com>

With the introduction of representors several eth devices are using
the same rte device (e.g. a PCI bus). It is therefore required to
release the eth device resources during an eth device close operation
rather than during an rte device removal (detach) operation.
In current version many PMDs are still releasing the eth device as
part of the rte device removal. In order to allow a smooth transition
for all PMDs to behave correctly an ethdev flag RTE_ETH_DEV_CLOSE_REMOVE
is used. When this flag is set it indicates to rte_eth_dev_close() to
call rte_eth_dev_release_port(), so the port is freed during the close
operation.

Signed-off-by: Ophir Munk <ophirmu@mellanox.com>
---
v1-v3
This patch was not part of the serie

v4:
Initial version

 drivers/net/mlx5/mlx5.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index 93b4057..7a8b45a 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -337,6 +337,17 @@
 	}
 	memset(priv, 0, sizeof(*priv));
 	priv->domain_id = RTE_ETH_DEV_SWITCH_DOMAIN_ID_INVALID;
+	/*
+	 * flag to rte_eth_dev_close() that it should release the port resources
+	 * (calling rte_eth_dev_release_port()) in addition to closing it.
+	 */
+	dev->data->dev_flags |= RTE_ETH_DEV_CLOSE_REMOVE;
+	/*
+	 * Reset mac_addrs to NULL such that it is not freed as part of
+	 * rte_eth_dev_release_port(). mac_addrs is part of dev_private so
+	 * it is freed when dev_private is freed.
+	 */
+	dev->data->mac_addrs = NULL;
 }
 
 const struct eth_dev_ops mlx5_dev_ops = {
-- 
1.8.3.1

  reply	other threads:[~2018-10-23 18:26 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-03  8:01 [dpdk-dev] [PATCH] net/mlx5: allow multi probing Ophir Munk
2018-10-05  1:41 ` Yongseok Koh
2018-10-05 11:20   ` Ophir Munk
2018-10-05 11:06 ` [dpdk-dev] [PATCH v2] net/mlx5: allow multiple probing for representor Ophir Munk
2018-10-05 18:06   ` Yongseok Koh
2018-10-09 22:23     ` Ophir Munk
2018-10-19  8:12   ` [dpdk-dev] [PATCH v3] " Ophir Munk
2018-10-23 18:26     ` [dpdk-dev] [PATCH v4 1/3] " Ophir Munk
2018-10-23 18:26       ` Ophir Munk [this message]
2018-10-23 18:26       ` [dpdk-dev] [PATCH v4 3/3] net/mlx5: close all ports on remove Ophir Munk
2018-10-24 13:19       ` [dpdk-dev] [PATCH v4 1/3] net/mlx5: allow multiple probing for representor Shahaf Shuler

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=1540319157-11191-2-git-send-email-ophirmu@mellanox.com \
    --to=ophirmu@mellanox.com \
    --cc=asafp@mellanox.com \
    --cc=dev@dpdk.org \
    --cc=olgas@mellanox.com \
    --cc=shahafs@mellanox.com \
    --cc=thomas@monjalon.net \
    --cc=yskoh@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 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).