From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ophir Munk Subject: [PATCH v4 2/3] net/mlx5: release port on close Date: Tue, 23 Oct 2018 18:26:04 +0000 Message-ID: <1540319157-11191-2-git-send-email-ophirmu@mellanox.com> References: <1539936770-24252-1-git-send-email-ophirmu@mellanox.com> <1540319157-11191-1-git-send-email-ophirmu@mellanox.com> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Cc: Thomas Monjalon , Olga Shern , Asaf Penso , Shahaf Shuler To: "dev@dpdk.org" , Yongseok Koh , Ophir Munk Return-path: Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-he1eur01on0045.outbound.protection.outlook.com [104.47.0.45]) by dpdk.org (Postfix) with ESMTP id C32C01B104 for ; Tue, 23 Oct 2018 20:26:05 +0200 (CEST) In-Reply-To: <1540319157-11191-1-git-send-email-ophirmu@mellanox.com> Content-Language: en-US List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 --- 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 =3D 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 |=3D 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 =3D NULL; } =20 const struct eth_dev_ops mlx5_dev_ops =3D { --=20 1.8.3.1