From mboxrd@z Thu Jan 1 00:00:00 1970 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) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=dL4yL07zFi7CjwrHX/Jyw3z8u3A+tQlcd+DKfJ7nDE0=; b=IeJ/o2ggBaqb9RvdhEtmXPQpG2nw3hHVy658KQEaRZppGYNutChuyqb2lRxm6zb+Owv5YgPPAUozrSQwzj+r882EDPFLRQ3QjwSUNwEoVV5Atck71A2OAbYDjXUG6nzevdbmKEOglrk6r9Iq1KDQLTwCUd7JudH19UTrm320VuA= Received: from AM6PR0502MB3735.eurprd05.prod.outlook.com (52.133.21.12) by AM6PR0502MB3624.eurprd05.prod.outlook.com (52.133.20.33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1273.18; Tue, 23 Oct 2018 18:26:04 +0000 Received: from AM6PR0502MB3735.eurprd05.prod.outlook.com ([fe80::5416:c31f:6c60:b280]) by AM6PR0502MB3735.eurprd05.prod.outlook.com ([fe80::5416:c31f:6c60:b280%5]) with mapi id 15.20.1250.028; Tue, 23 Oct 2018 18:26:04 +0000 From: Ophir Munk To: "dev@dpdk.org" , Yongseok Koh , Ophir Munk CC: Thomas Monjalon , Olga Shern , Asaf Penso , Shahaf Shuler Thread-Topic: [PATCH v4 2/3] net/mlx5: release port on close Thread-Index: AQHUav3bt3C3Mjr3p0aMHUCrCnJsEA== 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> In-Reply-To: <1540319157-11191-1-git-send-email-ophirmu@mellanox.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: LO2P265CA0388.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:f::16) To AM6PR0502MB3735.eurprd05.prod.outlook.com (2603:10a6:209:a::12) authentication-results: spf=none (sender IP is ) smtp.mailfrom=ophirmu@mellanox.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [37.142.13.130] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; AM6PR0502MB3624; 6:xCg2pRsr5oypo3xdj9I2uba2Zi4Ky9XNiHKld/81vO2tU8X8IkLkl1GtgGBJ638P0OeJ87XoFWEmb+GFL6s0Wxu8d611kKLuQGDmlfudgVyqmdVZ+jbCa6Rqr1L5lrDWI99pjTQQwBevp5ixSeANKgDpuzffz4OMnri6G4360cu4i9lWCRIxEXhT0obEfyl//hMnSqTu74kJk8RgTeLiYvZ5bnLHYnw7YcpMGbDlNImDg/lqoF602iCJxbJ8p7RqkeOH70yCiGUYuEbgG1ngdlOpUq88mMGb7KmWEh2/cUSsBHtL4t+d7ogwsmVKYEvZMxJGfy0kxm3lDJQfJYQ79dxgMuJ3/BLCNUvMwgbxSTH5eJBo2SL2MVcK8xlq9wNkmIYT6VPT7n5iFI4NbvC38yrTfsF68jG3jEnElOmemIxy9ohm6ffbwgCzgcuRDH92EnN8IGaOo1McBTC430UEyA==; 5:SGCKBBXOesRtswMD4pv5WaGfL12ISTa/NYyeYv/3VXwts+G/lftRymuxKrg1qIpqAHJv4//7K/zbwirTBTNPOlcG11CAJXUupIVwgqoOisYE95zhZ56fJpHct1tdRdMKUcKkLIzbvCZMXRYmYD04sf923bBzWLePSLyF4wx5k8Y=; 7:UAIAiWxwYISbeFjOckoJckJMbLPY56SFzuF6I59LhtuqFtnwajhuSg+Y2Mei96nIHNwqw5sVyqnDrqjSouUlNgc3HbjgRHxKBdsspenQEDO2F3K+3ROhomx2rHoFTQS3pnh4O5bycd6FhDmYcB00wA== x-ms-office365-filtering-correlation-id: 207a9e1b-04a2-431e-ab84-08d63914fde5 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(5600074)(711020)(4618075)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020); SRVR:AM6PR0502MB3624; x-ms-traffictypediagnostic: AM6PR0502MB3624: x-ld-processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(269456686620040); x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3231355)(944501410)(52105095)(3002001)(10201501046)(93006095)(93001095)(6055026)(148016)(149066)(150057)(6041310)(20161123560045)(20161123564045)(20161123558120)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699051)(76991095); SRVR:AM6PR0502MB3624; BCL:0; PCL:0; RULEID:; SRVR:AM6PR0502MB3624; x-forefront-prvs: 0834BAF534 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(376002)(136003)(396003)(346002)(366004)(39860400002)(199004)(189003)(2501003)(316002)(6512007)(81156014)(86362001)(5250100002)(11346002)(446003)(2616005)(476003)(25786009)(8936002)(2900100001)(110136005)(7049001)(54906003)(66066001)(97736004)(107886003)(68736007)(4326008)(71190400001)(71200400001)(8676002)(478600001)(14444005)(256004)(81166006)(486006)(53936002)(76176011)(186003)(3846002)(99286004)(5660300001)(6116002)(6506007)(6436002)(105586002)(2906002)(106356001)(14454004)(305945005)(7736002)(6486002)(26005)(52116002)(386003)(36756003)(102836004); DIR:OUT; SFP:1101; SCL:1; SRVR:AM6PR0502MB3624; H:AM6PR0502MB3735.eurprd05.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: vdiNyoKZoe0/hG0BnssDPCuhMgbKCW8armmO/NnM2vNY9GRShXe4tzNrVnwRtEuQPmWCoYKsIU2629h8mif4+srpGyDGcL4HlVQTAbphxAs4NLXIFNOEQBOxpzSQsTyI9hnG26QXUC1WYoipku6Fnva4S0Mzu8cZci2AOB1l6jgqCOZDsF7ZWeIlgLaQVMT/yEZa6BbQffcXq17AyEljhMeoMCKecn3tspbYEa6z6tEbXRQNDfQckoK1XVy0DV+8YqCJKfDsl7A19/OpUuQRAuRGQhBqmdEg04nnPSmDVwBuDAQrfh3qcRTWGtpm582ZKO8l6nYFYdf4tio5A67TTDkK58eBnIjOfQIIx5/0Smw= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 207a9e1b-04a2-431e-ab84-08d63914fde5 X-MS-Exchange-CrossTenant-originalarrivaltime: 23 Oct 2018 18:26:04.5695 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR0502MB3624 Subject: [dpdk-dev] [PATCH v4 2/3] net/mlx5: release port on close X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Oct 2018 18:26:06 -0000 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