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 BC0D9A0C52; Wed, 24 Nov 2021 12:02:32 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8549D40DF7; Wed, 24 Nov 2021 12:02:32 +0100 (CET) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by mails.dpdk.org (Postfix) with ESMTP id CDCC24003C for ; Wed, 24 Nov 2021 12:02:30 +0100 (CET) X-IronPort-AV: E=McAfee;i="6200,9189,10177"; a="222131238" X-IronPort-AV: E=Sophos;i="5.87,260,1631602800"; d="scan'208";a="222131238" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Nov 2021 03:02:29 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.87,260,1631602800"; d="scan'208";a="740805511" Received: from fmsmsx605.amr.corp.intel.com ([10.18.126.85]) by fmsmga005.fm.intel.com with ESMTP; 24 Nov 2021 03:02:29 -0800 Received: from fmsmsx611.amr.corp.intel.com (10.18.126.91) by fmsmsx605.amr.corp.intel.com (10.18.126.85) 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 03:02:28 -0800 Received: from fmsmsx602.amr.corp.intel.com (10.18.126.82) by fmsmsx611.amr.corp.intel.com (10.18.126.91) 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 03:02:28 -0800 Received: from fmsedg601.ED.cps.intel.com (10.1.192.135) by fmsmsx602.amr.corp.intel.com (10.18.126.82) 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 03:02:28 -0800 Received: from NAM04-MW2-obe.outbound.protection.outlook.com (104.47.73.168) by edgegateway.intel.com (192.55.55.70) 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 03:02:28 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LLze5tEHjPE396hNY22ETxRLArBtgsB9Duc6MWtiLaGtVtO4zmCD3ahnfJ+Y+Z/svuenW4yVRpZqtCw3XeDPPFVnhhtoEkNL3MBGFM0WPFstGlITkRaYwWinozrbry7u79JqMcftknhApC/g2tRFzHHVrDXQbXOKN4IjnhAYiUqiID4m5Fn7hvYU1R48j3Jsiq5bagdqMoXfBHOZiNVTHq0CBezzc4QJ6n+U5FBCGEwwwS3/pt0qaI/Yu6kFU8Cl+gwc5SVt7yr8RKXgy06X9EBY4DKx7kExxYJkftBJWvnOrJVmaLVXMwPrt/wy4AkPa0JcxDzy6zVKjR1z3ql6mA== 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=SUh/0JddgRfpo1VAP5v6o5Lx7bKtQo1xoSTolJwpWR8=; b=WrJ5z5vGZOyJf2b+hwnr5jbFRTmK3/YF4wneuVMSIfyfvK9s7SHucDUkjnd8Z4K55GeGslAao0LIPY88UlakwZWzEaYQmsH1pI7F8DBznwnwsLfPROkwJp0+C7/LNXB9vrUFcPwrpV9ojLnLfX1vqV4Ajd2BTsb6IHPK7BLgLpUHHKTtDPBomlPlo4tHeWHMXDzW1INYP+pHqP4XbX5dkqv2DgFhmsSmvR/2ibldm08bFD3i4Y2ZsRxk5oRx+Jp6G3VUpQTgoULZwzAEDFLqKSKzid5MjhOg2yQFsHYwW+iNcEmIaHqy52OVB96GAnt+nCaNKtY6xeVVvZvhOuUHIA== 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=SUh/0JddgRfpo1VAP5v6o5Lx7bKtQo1xoSTolJwpWR8=; b=RgqgtGbSse5bvqPnlKUMvx5kAkiCCohv/qgvceeXXcd/FX3CZ1uEP5ifm3pwMTe1ceP8hNSm/QKLXQrt5tWxk8343mjxolcqxBMzsFKe0kXEa4sVIG2idH8bvSoOekNlKwXsxciI+ZkMqqhppzNEHXtQ8CbEcFlpxl2bHXHf2WM= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from PH0PR11MB5000.namprd11.prod.outlook.com (2603:10b6:510:41::19) by PH0PR11MB4918.namprd11.prod.outlook.com (2603:10b6:510:31::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4734.21; Wed, 24 Nov 2021 11:02:27 +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.028; Wed, 24 Nov 2021 11:02:27 +0000 Message-ID: <57a1f49b-8797-48ee-9ec7-2ec60ad5a042@intel.com> Date: Wed, 24 Nov 2021 11:02:22 +0000 Content-Language: en-US To: Junxiao Shi , References: <119df28c7cc9d267@cs.arizona.edu> CC: "Jakub Grajciar -X (jgrajcia - PANTHEON TECH SRO at Cisco)" From: Ferruh Yigit Subject: Re: [PATCH] net/memif: allow stopping and closing device X-User: ferruhy In-Reply-To: <119df28c7cc9d267@cs.arizona.edu> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: DU2PR04CA0169.eurprd04.prod.outlook.com (2603:10a6:10:2b0::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 DU2PR04CA0169.eurprd04.prod.outlook.com (2603:10a6:10:2b0::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4734.22 via Frontend Transport; Wed, 24 Nov 2021 11:02:26 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 62512db6-8b60-42e4-e9e1-08d9af39e6fb X-MS-TrafficTypeDiagnostic: PH0PR11MB4918: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7691; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: e4X47UscBkk1MSuLcjmWWl/9plY7CxAX82Y1dk1tlq/nQvTIlAaTWFIH/v1BvnAEM85TtJlANkpVwWSvHtKaq1sJT4+uSnoV8D8sNkhD2ar6CwFsPyXr5wsUSdNZkIgsMhoiCQ9XHjzKk6GpprHjcrCbQBW47AG1H6P7iCn0dglyhBDkAt/0rIqnopMQGQ9qyKyPJ6U2trJLmw9Q00rsEEZb6UlGZTG6VWDDeLGWo5it8lsfYlSio98/M+Thdp65itTzEs04O3gjpgggi8H5UVbF3XfUYfS9gZReaJ4FLLd6jcz75ZyuxB/NFI0RO5nEwazQkvdmIHD7W0dFtIAX15Dlfm/bicdGvwRaKSNC8h8jXDWuoQObbrtoxKKYmjbxum0HnhsYOXn8AW500EZDQRurA4MWGAP1MSo5qdNUlp/7yI62zQewRAdpqi2EWNzkGQniWNTe4fxS7a2shuYSTzxspefKGIEgqoqzX/7LstAs2+RDlhgz+cfpZRjDzGCndlOspboCB39oI0bmMJlzykQAPY6B0n7TJCVl85a8IsXsVHYlvHtb3pe3bf34//KMfoQ3YutJsG+tMl/OKg4k81AeihuoUQFNe2kIAhNMOiylp1mYkK2Hxsbc2eWjENjQtOVtervuleO/RLZxLdHBy9hJbhoHDQNfqg8wCcmp2BTbQvUbB0VW6DS1nbUZj2sqxT8clLNDNOaQ+RQKxIRlqQ== 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)(66946007)(31686004)(16576012)(2616005)(36756003)(38100700002)(5660300002)(83380400001)(8676002)(31696002)(26005)(4326008)(82960400001)(2906002)(956004)(6666004)(66556008)(6486002)(86362001)(66476007)(508600001)(8936002)(316002)(44832011)(53546011)(186003)(45980500001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?OVNvSmtyRzFMTFQ0ejJKWWxSR1FTNXZiTmtOUWdhVW5ZTjAwQS9WTloxTFBl?= =?utf-8?B?bytOK29TMTlQM0c5QW1YMm1lV24wMG5mN2hBbHZJWGwvM2piMW45S1hMRnRH?= =?utf-8?B?Y2c1WGx3SGk0YXgrS0xSdmNTZE1GQk1naTRlUXp1ZjBHTmIraHlaY3h5dUJQ?= =?utf-8?B?dUpsN3RyS3lscnN5Y01Kell6N2VmR0M1Szc2aitMcHpZM1d1dk5rTEhha2ZP?= =?utf-8?B?UUdxNXRXU0pBQ1l5UGNqWkU0bHpKdWZKcXoxbmJUVDNwdzlEblE4N0hiTFVp?= =?utf-8?B?Q1VBbE1CRjZhYjI2M1hBUjFXYVhGNEhRU1BkVkJ5WHFFYzV6Z1dKVG1tTUZX?=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2lwWHpURWQvRWZ5TDR2MUxOY1Y3NWNw?= =?utf-8?Q?5VMR3wJLyP7VNK/93B7A1uk=3D?= X-MS-Exchange-CrossTenant-Network-Message-Id: 62512db6-8b60-42e4-e9e1-08d9af39e6fb X-MS-Exchange-CrossTenant-AuthSource: PH0PR11MB5000.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Nov 2021 11:02:27.5301 (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: qk5u7wlwf+jMANp36nbGZ541MkoNjLop6RBfqN4GUQdSV+crdmFgFTKd3DJ5KQspqxld9m4XHv78mh6JjYBSJQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR11MB4918 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/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. > } > > 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, >