From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id A6971A0C52; Wed, 24 Nov 2021 15:43:24 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2C3994115E; Wed, 24 Nov 2021 15:43:24 +0100 (CET) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by mails.dpdk.org (Postfix) with ESMTP id EB9B741158 for ; Wed, 24 Nov 2021 15:43:21 +0100 (CET) X-IronPort-AV: E=McAfee;i="6200,9189,10177"; a="222510500" X-IronPort-AV: E=Sophos;i="5.87,260,1631602800"; d="scan'208";a="222510500" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Nov 2021 06:43:20 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.87,260,1631602800"; d="scan'208";a="509896192" Received: from orsmsx606.amr.corp.intel.com ([10.22.229.19]) by orsmga008.jf.intel.com with ESMTP; 24 Nov 2021 06:43:18 -0800 Received: from orsmsx608.amr.corp.intel.com (10.22.229.21) by ORSMSX606.amr.corp.intel.com (10.22.229.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12; Wed, 24 Nov 2021 06:43:17 -0800 Received: from orsedg603.ED.cps.intel.com (10.7.248.4) by orsmsx608.amr.corp.intel.com (10.22.229.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12 via Frontend Transport; Wed, 24 Nov 2021 06:43:17 -0800 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (104.47.70.101) by edgegateway.intel.com (134.134.137.100) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2242.12; Wed, 24 Nov 2021 06:43:16 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XpfSdvvpPKvSw1n/LlKvCW7dMF4y90SQWm8Hvnwj/yBN8cYF3Z6mNmFCflQmHpKx8iEY3JpS/diLBDMUDGYakxaUV7e4QpsxnEaOY0BgRa2CsBD1wNvU/JliMDYebW4LcUyeoTbO9SRJwwp68ocdNjwl5FvNNgXSNiJcjNJXBTf7rSp9DavV6jTPbl5G9JDC3DEHeD0BsNAqfqBb1qEa/PBKgCp2sAi4IfMjn86hs/1dDQX21ZaDjWZn9+BRrTzwZ8bFcbjCJ0K6m+dve6RzwCD2sv3Hya+FjcAG7F4O61TbbGaMmRkNg1Z1fMtS/vhLU46qYzKBz9ExGKhUfSnFEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=8pJ6VNBTjdaAMWjwVBVbukrQWLmqGmTwa7tcF5M2AJM=; b=O+290iK2rnqRWEXEPpq/aTra+WO8WhX39umDaByvCYoXW4f5jfvYwEK3YWWt5VqtkEHU/EmBrI8VayPbIDy5e2/9mmgbmX87h/rfmX0fFqFpQW/6Xh/wfTsTf84JYSBOYPuzydHAKk9G+Z0jxhFZx1z6uFFDf17sEnh2pNw5KB+2SuSxZb+4KrlYjFdzDfQH5GaE7ELwXvfoIBkSaSIKagsl4DFGDEKg0sA2VNP/19SvJAxwHQisydNkSqV6Do3+gelsGJmra9U7wNz/uo8q2xCaioKrjkN0Ac3+XQdgeok9ZtXNXIcQqYQeJIfE7qXToIriK3kHVBI6vkMvFEk+/g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=8pJ6VNBTjdaAMWjwVBVbukrQWLmqGmTwa7tcF5M2AJM=; b=RJULOMuyJa9zKGUSm6giM2fxsgEMhfEzb2O/n2ZgdoVFKFKP3fC5JAm6vFDdKUgmpO5AHl1Cf5ZdKMGGGk4/gq0UG9VDy5qcTP+gk2eAP19EJqg3PNzyglAy/3mNANeafi7Cep81zywRrroNGSfdf0unUmVQHBBVa0ZBa5/qDWo= Authentication-Results: gmail.com; dkim=none (message not signed) header.d=none;gmail.com; dmarc=none action=none header.from=intel.com; Received: from PH0PR11MB5000.namprd11.prod.outlook.com (2603:10b6:510:41::19) by PH7PR11MB5794.namprd11.prod.outlook.com (2603:10b6:510:131::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4587.22; Wed, 24 Nov 2021 14:43:15 +0000 Received: from PH0PR11MB5000.namprd11.prod.outlook.com ([fe80::bc5f:31a7:10ad:443c]) by PH0PR11MB5000.namprd11.prod.outlook.com ([fe80::bc5f:31a7:10ad:443c%5]) with mapi id 15.20.4690.030; Wed, 24 Nov 2021 14:43:15 +0000 Message-ID: <9a043057-ff91-b21d-4f92-37dcf9c604b4@intel.com> Date: Wed, 24 Nov 2021 14:43:09 +0000 Content-Language: en-US To: yoursunny CC: Junxiao Shi , , "Jakub Grajciar -X (jgrajcia - PANTHEON TECH SRO at Cisco)" References: <119df28c7cc9d267@cs.arizona.edu> <57a1f49b-8797-48ee-9ec7-2ec60ad5a042@intel.com> From: Ferruh Yigit Subject: Re: [PATCH] net/memif: allow stopping and closing device X-User: ferruhy In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-ClientProxiedBy: DU2PR04CA0199.eurprd04.prod.outlook.com (2603:10a6:10:28d::24) To PH0PR11MB5000.namprd11.prod.outlook.com (2603:10b6:510:41::19) MIME-Version: 1.0 Received: from [192.168.0.206] (37.228.236.146) by DU2PR04CA0199.eurprd04.prod.outlook.com (2603:10a6:10:28d::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4734.20 via Frontend Transport; Wed, 24 Nov 2021 14:43:14 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2fdc3731-b01d-454b-9dba-08d9af58bf72 X-MS-TrafficTypeDiagnostic: PH7PR11MB5794: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:9508; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Y6CIqbuc6PWKELAywm7R+Bjdi+qbbWrBrc/6QUtlaclPGBSNJ/klxGHGptKPFNtBE5Zhs+SiCStnSZw6I82YR97VQX/153qc3WBl6ngYZKJqZIJJfNrJkyOznbFEVsAfLslMGVaDuiCuQATnyFRoncmXARXAiOziER0kukwWk+aqrbdRHCiQCL//UYCOlx70hopdrCWrxsyV32T4/jrX358xzU0eQQxPfWpjkBeDXySyw2zETgABmJeX4uHprHOLT8SFspuyLZ7mRJ3dm56FaJgUwZCkQ63eVH1Ddws8OBTti0/gRvV6sRK/xtcj5STcfkREDPKXK+bRSuxZ1nSV6pGef72v3PS9WB1ap/y9AWo2RD11v51NhA+PCKiKML8/kdSvMgO3KeSqGc72Ybm1Y6Y0kEa6TQK7uaJ36IXO10rd6AzZsow1hexh8GlhWNMDkutasdJnUCTNglxbMAjS6AlJqRWHrdjzNYAp4D9qDwPujpcGEB01oTknvFCphmt2iwcTUwvvH5F8EfyY3PdLqN+iJO6uDETlsEBzX0UwJdJxJifX5UDgXaB2FPqpKpmenKY0SwZLI/qzFol6poyKtJkWZP4iq+uP/81JzwuDZ7FEqe3Jst1BMrHaDPU9zK4BNUN1E1a0WqDGEB2YZu4FuixiAvaIO1Y8VhH0rFQx8XVGV0d7cV8UjtRpXo1hqCvCXcfLtaI37nlfsuKnyl6KOQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PH0PR11MB5000.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(366004)(36756003)(6666004)(38100700002)(4326008)(83380400001)(31696002)(66476007)(8936002)(6916009)(54906003)(2906002)(316002)(82960400001)(86362001)(53546011)(66946007)(2616005)(186003)(31686004)(26005)(956004)(44832011)(8676002)(6486002)(5660300002)(16576012)(508600001)(66556008)(45980500001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?SitKUG9RbEdmSk1GcTQwMlhxKzFUVXlwUmZFaHR3amFIYzk0amlibURIUlNu?= =?utf-8?B?blcvK2tiekhwb1Qwbml5OGx0SVB3Tk8wbzBmNDlmQjJMYVpKUGRhOEh2NFA2?= =?utf-8?B?bDg4MUV6YWhTeVhaeHFsLzlQMkxXVzZOOUlwOWVOQjFaS2VSOGVYN2VMalN2?= =?utf-8?B?cDE2MWxzMlV4c0ppRXptdWtJTkVIOVRmUTE1Nzdwd21ucXB0Z2F5bVcvZXBs?= =?utf-8?B?dGlyNHRCbnh0WWxnaytpUTQ5TUp4aTM1OTBiN1RGU0NTRzJQamZaOGtNenhY?= =?utf-8?B?OWgzc1BOMzNsU2lHUDlTaTRZZGxzZklrbmhDVXFxRE9oZFZiVUI5MUpLaHdL?= =?utf-8?B?dzhvMnVvZFFxMytHclV3bFJweEtMZUJ3TThCeTVLZ01tby91Rmx3WEt3Z0hS?= =?utf-8?B?dXJMNXlyK0VUSzhuK01sT2RmMzdqMm0yTHdMaGVkYjJUcVVQYlVJ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Xk2UFN0MDJKVStuelEvdmRiQmp0UW5xeEdT?= =?utf-8?B?UXIrWU9WalFoT1o0aUVUNXUxQlYyV2pscWptbXNsM290bHY2dmRoS0J0eVds?= =?utf-8?B?ejlpclZWWWwwd3I4Tm83K3BDZy9jK2hLTjBvU1g4cVhyWVp2Z3FuUFArNXdK?= =?utf-8?B?WCtISHE4V3dLaUlRMS9TaHVIUUtCL0dLQkhVYTJkNjErUWRIenAycTV3SnBB?= =?utf-8?B?VUlWVjVSam4xUUNNQjF3dU95T0grSFVGVWEzR053SUdCcDVpMmhtdWVFWVNK?= =?utf-8?B?STJvZDJscGM1T2ppSC9zQkM1eXFkV3NVajZ1Y0xGcHk5cWxQZDVsVEpmdk5k?= =?utf-8?B?OGU2T0VKbWRoUDJta2hEMzRjTXdJVklpeTltMk1iVWVyWlRVK09BMFhMV2Rj?= =?utf-8?Q?EW3w5OPuTfY1CkwNt5QREysj5RlVF/2DQc7a1U6?= X-MS-Exchange-CrossTenant-Network-Message-Id: 2fdc3731-b01d-454b-9dba-08d9af58bf72 X-MS-Exchange-CrossTenant-AuthSource: PH0PR11MB5000.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Nov 2021 14:43:15.5758 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: oxbE+m1EMhjAnZTwfdW+dA5u2aWVjjX5gund8czi8m01HDm0o32q7dYr6lR7kygBEbRZdb47qV5WHjZ4sDw1Wg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR11MB5794 X-OriginatorOrg: intel.com X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On 11/24/2021 2:01 PM, yoursunny wrote: Hi Junxiao, comment moved down, please don't top post, it makes following the discussion very hard in the archive. > Yours, Junxiao > > On Wed, Nov 24, 2021, 06:02 Ferruh Yigit > wrote: > > On 11/18/2021 5:33 PM, Junxiao Shi wrote: > > Bugzilla ID: 888 > > Fixes: febc855b358e ("ethdev: forbid closing started device") > > > > Signed-off-by: Junxiao Shi > > > Thanks Junxiao, +1 to this fix, cc'ed memif maintainer Jakub. > > > --- > >   drivers/net/memif/rte_eth_memif.c | 11 ++++++++--- > >   1 file changed, 8 insertions(+), 3 deletions(-) > > > > diff --git a/drivers/net/memif/rte_eth_memif.c b/drivers/net/memif/rte_eth_memif.c > > index 43d7378329..e3d523af57 100644 > > --- a/drivers/net/memif/rte_eth_memif.c > > +++ b/drivers/net/memif/rte_eth_memif.c > > @@ -1260,6 +1260,13 @@ memif_dev_start(struct rte_eth_dev *dev) > >       return ret; > >   } > > > > +static int > > +memif_dev_stop(struct rte_eth_dev *dev) > > +{ > > +     memif_disconnect(dev); > > Is the 'memif_dev_stop()' safe to be called multiple times? > If 'memif_dev_close()' calls 'memif_dev_stop()' (see below), it is possible > to call 'memif_dev_stop()' multiple times, so it should be protected. > > > +     return 0; > > +} > > + > >   static int > >   memif_dev_close(struct rte_eth_dev *dev) > >   { > > @@ -1268,7 +1275,6 @@ memif_dev_close(struct rte_eth_dev *dev) > > > >       if (rte_eal_process_type() == RTE_PROC_PRIMARY) { > >               memif_msg_enq_disconnect(pmd->cc, "Device closed", 0); > > -             memif_disconnect(dev); > > > >               for (i = 0; i < dev->data->nb_rx_queues; i++) > >                       (*dev->dev_ops->rx_queue_release)(dev, i); > > @@ -1276,8 +1282,6 @@ memif_dev_close(struct rte_eth_dev *dev) > >                       (*dev->dev_ops->tx_queue_release)(dev, i); > > > >               memif_socket_remove_device(dev); > > -     } else { > > -             memif_disconnect(dev); > > Should we add 'memif_dev_stop()' within the close function? > Otherwise we are relying on user to stop, but at least in remove path > ('rte_pmd_memif_remove()') that may not be the case. > > Hi Ferruh > > You have to rely on user to call stop before calling close/remove. > This is mandated in ethdev library, as implemented in: > febc855b358e ("ethdev: forbid closing started device") > Yes it is enforced, and 'rte_pmd_memif_remove()' calls 'rte_eth_dev_close()' instead of 'memif_dev_close()', so agree that it won't mean much to add stop() within close(). I will proceed with the patch without waiting review from Jakup to have it in the release. > >       } > > > >       rte_free(dev->process_private); > > @@ -1515,6 +1519,7 @@ memif_rx_queue_intr_disable(struct rte_eth_dev *dev, uint16_t qid __rte_unused) > > > >   static const struct eth_dev_ops ops = { > >       .dev_start = memif_dev_start, > > +     .dev_stop = memif_dev_stop, > >       .dev_close = memif_dev_close, > >       .dev_infos_get = memif_dev_info, > >       .dev_configure = memif_dev_configure, > > >