From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR03-AM5-obe.outbound.protection.outlook.com (mail-eopbgr30057.outbound.protection.outlook.com [40.107.3.57]) by dpdk.org (Postfix) with ESMTP id B912F3572 for ; Tue, 12 Mar 2019 22:53:45 +0100 (CET) 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=fGGifT3fjId2DpqNfkye6XsIiUAMnBnJNt2l2gdXfYo=; b=feaolmAFZfnSIyP+lHG62D2583sQMC7q6Lrel4q3lL+YrsvaUVsMv394gPxuKUs6HkMRkSdljBHWT6Qo2b2IfGV8UaPq43Z8htVUz+94o435/aS6dBF70SbPZ1VGYAF8lThLOIAn5BD1BwaL9Y9/rHfVxaMa91eH6i/bwtQddy8= Received: from DB3PR0502MB3980.eurprd05.prod.outlook.com (52.134.72.27) by DB3PR0502MB3995.eurprd05.prod.outlook.com (52.134.72.30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1686.18; Tue, 12 Mar 2019 21:53:44 +0000 Received: from DB3PR0502MB3980.eurprd05.prod.outlook.com ([fe80::580c:ae7b:8278:cc50]) by DB3PR0502MB3980.eurprd05.prod.outlook.com ([fe80::580c:ae7b:8278:cc50%3]) with mapi id 15.20.1709.011; Tue, 12 Mar 2019 21:53:44 +0000 From: Yongseok Koh To: "Pattan, Reshma" CC: "stable@dpdk.org" , "Zhang, Pan1" Thread-Topic: [dpdk-stable] [ PATCH 17.11 1/2] ethdev: clear ethdev data upon detach Thread-Index: AQHU0CVl14k0rQ6SDEa+mwc0GfhZ8qX76KKAgAvj1YCAAM9cgA== Date: Tue, 12 Mar 2019 21:53:44 +0000 Message-ID: References: <20190301115323.32420-1-reshma.pattan@intel.com> <3AEA2BF9852C6F48A459DA490692831F2A429CBA@irsmsx110.ger.corp.intel.com> In-Reply-To: <3AEA2BF9852C6F48A459DA490692831F2A429CBA@irsmsx110.ger.corp.intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=yskoh@mellanox.com; x-originating-ip: [209.116.155.178] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 98bf51ab-3e38-43a0-fb8a-08d6a7353286 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600127)(711020)(4605104)(4618075)(2017052603328)(7153060)(7193020); SRVR:DB3PR0502MB3995; x-ms-traffictypediagnostic: DB3PR0502MB3995: x-microsoft-exchange-diagnostics: =?us-ascii?Q?1; DB3PR0502MB3995; 23:f376aRBYLfUKYRN5H3dxsWjWiv1AHgDecaqVNDA?= =?us-ascii?Q?4rYoyo+ysSF2S+NdbY4ebcVdRlc2WyYqd3RULYCcd0hA3I/B0AavRcaZhbpk?= =?us-ascii?Q?rBp95EKnpFHrnnJ6ocupCkxis+dvvZAkKFAJkvAsvXbF2jn8b60iMPcQTyE8?= =?us-ascii?Q?CBvnJe5JVsyEeMrc8NrL1/UyWPsTRr4FoWFvTAeeSBgEINg7PclsviMJ6MCW?= =?us-ascii?Q?lhdEuK86m7MoQjvNQ/pouRWS5c8L/OWWb1O2SfocyJP99wHsPV/DNtKG4WJa?= =?us-ascii?Q?o6Xdq3feQ1u/2P29l6We5zBz5Sfxhxa6s2KfCdC9cxlvy3TpcWIAuQoIHEGx?= =?us-ascii?Q?ubOB8Yv/SbNf3oqwGkdaHuKxmC6va2TxURfAbsBahy+iuzNnrhR1iaATxCpB?= =?us-ascii?Q?t01yDKX021916Gigd6Vi9AFcNi67K8WfKOxOgdWAm32G+RZEGpR1MU74NbZQ?= =?us-ascii?Q?ADQlVzxOC9I0EPvAEDDUS9+9NgJ1bAwPswsDclS2reME0l0pY44rFnkrlVTx?= =?us-ascii?Q?ANGyOux4mJPkc5xVvi+M9O5DoyBjc3HXG9vFFfu/eqogdH8Ux9Ea2UIh/Qj9?= =?us-ascii?Q?ComoGmI0PcYwDY1ezEfW/QyVHeE3YXMBijAdlVKa9JPJ9OHqG+EugddLSkuy?= =?us-ascii?Q?vHQTGH7NrwkOA01HHi74XcAuu8cOD3mpNgs4uOp6STiFI1pvR0E0sNFbrXn6?= =?us-ascii?Q?Ez3o8HZN6lO8F3XXdLrCDL+P8//Q2hBBsY14k1N62aNMJqHSNQKe6WhCtmBP?= =?us-ascii?Q?ROtleShyNAtDQJUColk9Rwi2N3vW6QvSrsOC7RwMsVnwiUdJ418EkvXVI2Mb?= =?us-ascii?Q?rLsYDKs96cpS7q7NYELU0jnd5ci3aHOlbDEeVbSAgpTswFlpiMPx15UCReC/?= =?us-ascii?Q?U6o+CIWC1x963UN9Xx+7suYKenktE/lrOXWVNLQmTQSWwb0S8PSWNYQrD/MF?= =?us-ascii?Q?ui3AJhlegaQNHJAOIvzg2q9zKlweLmXOS7G03e52wpWI6A0C/1++VHEvhE1D?= =?us-ascii?Q?qmEexGMq4uxXNfgA0hh+McGIEdS/jjBMsSMadsY/jXCDTlfUoKTUATHGENiZ?= =?us-ascii?Q?WS+/5mNjKfahv9+v9mJqRsVSUXh2+gAON0jArbec4BR/hfp+yvK35voQ8HJf?= =?us-ascii?Q?8yOd/2P39iYbPZ8RCfcabZ9ivA4DBUXa7TlyPTd+qG+s8LsoODy6NQtPC6VC?= =?us-ascii?Q?ulgmq4k0pme0mLeQmB6+rJx9345NR2C45fEf62U1gn31Qckci5sk0DfNCmhx?= =?us-ascii?Q?OgCRam3SrgLJMR4EJOUUnvaaOai21ZcI6Xh5vlWzy?= x-microsoft-antispam-prvs: x-forefront-prvs: 09749A275C x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(136003)(376002)(346002)(396003)(39850400004)(366004)(13464003)(199004)(189003)(2906002)(33656002)(97736004)(6916009)(99286004)(25786009)(229853002)(305945005)(106356001)(82746002)(6512007)(81166006)(86362001)(66066001)(54906003)(68736007)(4326008)(81156014)(256004)(5024004)(36756003)(53936002)(316002)(6116002)(6506007)(3846002)(8936002)(478600001)(14454004)(6486002)(5660300002)(105586002)(6246003)(53546011)(6436002)(7736002)(186003)(26005)(83716004)(71190400001)(2616005)(476003)(71200400001)(486006)(11346002)(76176011)(446003)(102836004); DIR:OUT; SFP:1101; SCL:1; SRVR:DB3PR0502MB3995; H:DB3PR0502MB3980.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-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: bYBNnUVx9doB2l1eEZhN7eWGYcDAgbCeQg5j3mXpmAhWrvQ4+BIShRjRxJmI22dgef1Zv8RHZ7WNiRm6R+QCqDAZtxqU03Lknir9VTH4BIjcqOI/0sZgkzxodhPBcEciKyqXEpEFgsFUKWUXEdyTdgeavBhEIBEgUCnwoknnTVL4swPAfSzpl58dyLY3MvJKW4qfQ7s7n96xLJ1QRNDrjLgOK59Av8SCC6sZmkBXESbbZ3O6EO4xTJ/2d5I0JoPRRcYaiPlNQIyrmd3bQKRHcke7Ob+m7gF1DlNBJ3/DYVvCyvSsZrTrdgPpcfd1JmPuwvts56EkCz1+kLCRDEAy4MyYVkIL5S/DFPEvN0Nb8MKxbFPp8wvJxoAkSNmdzFGc/oBIShFl+oVQMhsw80SynZ2sNzjiOuSSeG+ZRuXCfSI= Content-Type: text/plain; charset="us-ascii" Content-ID: <893AC8DA4C0CBA46AD166AB41006B35F@eurprd05.prod.outlook.com> Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 98bf51ab-3e38-43a0-fb8a-08d6a7353286 X-MS-Exchange-CrossTenant-originalarrivaltime: 12 Mar 2019 21:53:44.1435 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB3PR0502MB3995 Subject: Re: [dpdk-stable] [ PATCH 17.11 1/2] ethdev: clear ethdev data upon detach X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Mar 2019 21:53:45 -0000 > On Mar 12, 2019, at 2:31 AM, Pattan, Reshma wro= te: >=20 > Hi, >=20 >> -----Original Message----- >> From: Yongseok Koh [mailto:yskoh@mellanox.com] >> Sent: Monday, March 4, 2019 7:57 PM >> To: Pattan, Reshma >> Cc: stable@dpdk.org >> Subject: Re: [dpdk-stable] [ PATCH 17.11 1/2] ethdev: clear ethdev data = upon >> detach >>=20 >>=20 >>> On Mar 1, 2019, at 3:53 AM, Reshma Pattan >> wrote: >>>=20 >>> When port is detached its relevant rte_eth_dev_data[port_id] has to be >>> zeroed, otherwise the next port creations could get wrong port_id. >>>=20 >>> Fixes: 92d94d3744 ("ethdev: attach or detach port") >>> Signed-off-by: Reshma Pattan >>> --- >>> lib/librte_ether/rte_ethdev.c | 1 + >>> 1 file changed, 1 insertion(+) >>>=20 >>> diff --git a/lib/librte_ether/rte_ethdev.c >>> b/lib/librte_ether/rte_ethdev.c index 096b35faf..7ba9bc564 100644 >>> --- a/lib/librte_ether/rte_ethdev.c >>> +++ b/lib/librte_ether/rte_ethdev.c >>> @@ -443,6 +443,7 @@ rte_eth_dev_detach(uint16_t port_id, char *name) >>> goto err; >>>=20 >>> rte_eth_devices[port_id].state =3D RTE_ETH_DEV_UNUSED; >>> + memset(&rte_eth_dev_data[port_id], 0, sizeof(struct >>> +rte_eth_dev_data)); >>=20 >> Hi, >>=20 >> I believe such code is good to have. Before I merge it, I have a questio= n. >> I wonder what the problem of the current code is. >> If the state turns into RTE_ETH_DEV_UNUSED, then will the eth_dev be re- >> initialized next time anyway? >>=20 >>=20 >=20 > Yes to reuse the UNUSED port next time , its relevant rte_eth_dev_data[] = also has to be 0 (which is missing in current code), because attach operati= on not only checks for UNUSED but also for its relevant data to be 0. > If state UNUSED, but data still not 0, the attach operation will assume p= ort is under use, so it will assign the next new available port id which i= s wrong. So we are now fixing this by zeroing dev data upon detach operatio= n. applied to stable/17.11 Thanks, Yongseok